/*
freew.org lists apps and repositories and states the terms of each.
Copyright (C) 2026 Pengfan Chang
Contact: https://swiphtgroup.com/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/* Tokens */

:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --bar: rgba(245, 245, 247, 0.82);
  --card: #ffffff;
  --label: #1d1d1f;
  --secondary: #636366;
  --separator: rgba(60, 60, 67, 0.2);
  --fill: rgba(120, 120, 128, 0.12);
  --blue: #0058d0;
  --selection: rgba(0, 0, 0, 0.06);
  --free: #17642f;
  --free-bg: #e3f4e8;
  --restricted: #8a4500;
  --restricted-bg: #fbecd7;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.375rem;
  --text-xl: clamp(2rem, 1.4rem + 2.6vw, 3rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 40px;
  --space-7: 64px;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --page: 1120px;
  --measure: 68ch;

  --external-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M1.2 4.1h2.1v1.2H2.4v4.3h4.3V8.4h1.2v2.3c0 .5-.4.9-.9.9H2.1c-.5 0-.9-.4-.9-.9V5c0-.5.4-.9.9-.9z'/%3E%3Cpath fill='%23000' d='M6.2 1.4h4.4v4.4H9.4V3.5L5.6 7.3 4.7 6.4l3.8-3.8H6.2V1.4z'/%3E%3C/svg%3E");
  --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 14'%3E%3Cpath d='M2.2 1.5 6.8 7 2.2 12.5' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.4 4.9 9l4.9-6' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --lock-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Crect x='2.2' y='5.3' width='7.6' height='5.5' rx='1.2' fill='%23000'/%3E%3Cpath d='M3.9 5.5V3.9a2.1 2.1 0 0 1 4.2 0v1.6' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E");
  --glyph-terminal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231d1d1f' d='M1.4 4.1 6.5 8 1.4 11.9 2.8 13.4 9.4 8 2.8 2.6Z'/%3E%3Cpath fill='%231d1d1f' d='M9.2 11.5h5.4v1.7H9.2z'/%3E%3C/svg%3E");
  --glyph-server: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1.8' y='2' width='12.4' height='4.4' rx='1.1' fill='%23fff'/%3E%3Crect x='1.8' y='9.6' width='12.4' height='4.4' rx='1.1' fill='%23fff'/%3E%3Ccircle cx='4.2' cy='4.2' r='.75' fill='%238e8e93'/%3E%3Ccircle cx='4.2' cy='11.8' r='.75' fill='%238e8e93'/%3E%3C/svg%3E");
  --glyph-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231d1d1f' d='M8 14.2 6.9 13.2C3 9.7 1.3 8 1.3 5.6c0-1.9 1.5-3.4 3.4-3.4 1.3 0 2.5.6 3.3 1.6.8-1 2-1.6 3.3-1.6 1.9 0 3.4 1.5 3.4 3.4 0 2.4-1.7 4.1-5.6 7.6L8 14.2z'/%3E%3C/svg%3E");
  --glyph-cup: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M1.8 4.2h9.4v5.4a3.4 3.4 0 0 1-3.4 3.4H5.2a3.4 3.4 0 0 1-3.4-3.4V4.2z'/%3E%3Cpath d='M11.2 5.6h1.2a1.75 1.75 0 0 1 0 3.5h-1.2' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3C/svg%3E");
  --glyph-target: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='5.6' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Ccircle cx='8' cy='8' r='2.9' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Ccircle cx='8' cy='8' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bar: rgba(18, 18, 19, 0.8);
    --card: #1c1c1e;
    --label: #f5f5f7;
    --secondary: #a1a1a8;
    --separator: rgba(120, 120, 128, 0.4);
    --fill: rgba(120, 120, 128, 0.24);
    --blue: #4c9dff;
    --selection: rgba(255, 255, 255, 0.12);
    --free: #6fdc8c;
    --free-bg: #12301b;
    --restricted: #ffb65c;
    --restricted-bg: #3a2608;
    --card-shadow: 0 0 0 0.5px var(--separator);
    --card-shadow-hover: 0 0 0 1px rgba(160, 160, 170, 0.6);
  }
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.47;
  letter-spacing: -0.014em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
}

img,
video {
  max-width: 100%;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: var(--space-4);
  top: -64px;
  z-index: 4;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.skip:focus {
  top: calc(var(--space-3) + env(safe-area-inset-top));
}

/* One shared rule for every masked icon */

.external::after,
.badge::before,
summary::after {
  content: "";
  flex: none;
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.external::after {
  --icon: var(--external-icon);
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.3em;
  opacity: 0.72;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bar);
  border-bottom: 0.5px solid var(--separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.topbar-inner,
.page {
  width: min(var(--page), 100%);
  margin-inline: auto;
  padding-left: calc(var(--space-5) + env(safe-area-inset-left));
  padding-right: calc(var(--space-5) + env(safe-area-inset-right));
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--space-4);
  padding-top: env(safe-area-inset-top);
}

.wordmark {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.wordmark a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--label);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-right: calc(-1 * var(--space-3));
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a[aria-current] {
  color: var(--label);
  font-weight: 600;
}

.site-nav a:active {
  background: var(--selection);
}

@media (hover: hover) {
  .site-nav a:hover {
    color: var(--label);
    background: var(--selection);
  }
}

/* Page */

.page {
  flex: 1;
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

#content {
  scroll-margin-top: 72px;
}

h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  color: var(--secondary);
  font-size: var(--text-lg);
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.copy {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-4);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.section-count {
  color: var(--secondary);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Badges: text and an icon, never colour alone */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.badge::before {
  width: 12px;
  height: 12px;
}

.badge.free {
  --icon: var(--check-icon);
  background: var(--free-bg);
  color: var(--free);
}

.badge.restricted {
  --icon: var(--lock-icon);
  background: var(--restricted-bg);
  color: var(--restricted);
}

/* Card grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.card a:focus-visible {
  outline: none;
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
  }
}

.card-preview {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--fill) center / 30% no-repeat;
  border-bottom: 0.5px solid var(--separator);
  overflow: hidden;
}

.card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.card-preview .phosphor-screen {
  height: 100%;
  padding: var(--space-4);
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  overflow: hidden;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4);
}

.card-kind {
  margin: 0;
  color: var(--secondary);
  font-size: var(--text-xs);
  letter-spacing: 0;
}

.card-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

/* The whole card is the link target */
.card-title a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-summary {
  margin: 0 0 var(--space-3);
  color: var(--secondary);
  font-size: var(--text-sm);
  line-height: 1.4;
  text-wrap: pretty;
}

.card .badge {
  margin-top: auto;
}

/* Entries without a screenshot or palette: a glyph on the entry's colour.
   Adding an entry needs at most one rule here. */

[data-entry="ctmu"] .card-preview {
  background-color: #34c759;
  background-image: var(--glyph-terminal);
}

[data-entry="rockyback"] .card-preview {
  background-color: #8e8e93;
  background-image: var(--glyph-server);
}

[data-entry="liberapay"] .card-preview {
  background-color: #f6c915;
  background-image: var(--glyph-heart);
}

[data-entry="kofi"] .card-preview {
  background-color: #ff5e5b;
  background-image: var(--glyph-cup);
}

[data-entry="issuehunt"] .card-preview {
  background-color: #0a8ea0;
  background-image: var(--glyph-target);
}

/* Entry pages */

.breadcrumb {
  margin: 0 0 var(--space-4);
  color: var(--secondary);
  font-size: var(--text-sm);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: var(--space-2);
  opacity: 0.6;
}

.entry-head {
  margin-bottom: var(--space-5);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  color: var(--secondary);
  font-size: var(--text-sm);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--fill);
  color: var(--label);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .button.primary {
    color: #00122e;
  }
}

@media (hover: hover) {
  .button:hover {
    background: var(--selection);
  }

  .button.primary:hover {
    background: var(--blue);
    filter: brightness(1.1);
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: var(--space-5);
  margin: var(--space-5) 0 0;
}

.shot {
  margin: 0;
}

.shot img,
.shot video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--fill);
  box-shadow: var(--card-shadow);
}

.shot figcaption,
.phosphor figcaption {
  margin: var(--space-2) var(--space-1) 0;
  color: var(--secondary);
  font-size: var(--text-xs);
  line-height: 1.4;
}

details {
  max-width: var(--measure);
  margin: var(--space-5) 0 0;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  --icon: var(--chevron-icon);
  width: 8px;
  height: 13px;
  color: var(--secondary);
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

details[open] > summary::after {
  transform: rotate(-90deg);
}

summary:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--blue);
}

details > :not(summary) {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
  color: var(--secondary);
  font-size: var(--text-sm);
}

/* Facts: definition lists in cards */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-5);
  align-items: start;
  margin-top: var(--space-6);
}

.facts section,
.terms {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.facts h2,
.terms h2 {
  margin: 0 0 var(--space-2);
  color: var(--secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.facts-note {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.facts dl,
.terms dl {
  margin: 0;
}

.facts dl > div,
.terms dl > div {
  padding: var(--space-3) 0;
}

.facts dl > div + div,
.terms dl > div + div {
  border-top: 0.5px solid var(--separator);
}

.facts dt,
.terms dt {
  font-weight: 600;
}

.facts dd,
.terms dd {
  margin: 2px 0 0;
  color: var(--secondary);
  font-size: var(--text-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.facts code {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: 0;
}

.terms {
  max-width: var(--measure);
  margin-top: var(--space-5);
}

.back {
  margin: var(--space-6) 0 0;
  font-size: var(--text-sm);
}

/* Pricing table */

.table-wrap {
  margin-top: var(--space-5);
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.terms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.terms-table caption {
  padding: var(--space-4);
  color: var(--secondary);
  text-align: left;
}

.terms-table th,
.terms-table td {
  padding: var(--space-3) var(--space-4);
  border-top: 0.5px solid var(--separator);
  text-align: left;
  vertical-align: top;
}

.terms-table thead th {
  color: var(--secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.terms-table tbody th {
  font-weight: 600;
}

@media (max-width: 719px) {
  .terms-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .terms-table,
  .terms-table tbody,
  .terms-table tr,
  .terms-table th,
  .terms-table td {
    display: block;
  }

  .terms-table tr {
    padding: var(--space-3) 0;
    border-top: 0.5px solid var(--separator);
  }

  .terms-table th,
  .terms-table td {
    padding: 2px var(--space-4);
    border: 0;
  }

  .terms-table td::before {
    content: attr(data-label) ": ";
    color: var(--secondary);
  }
}

/* Theme previews. The colours are the themes' own. */

.phosphor {
  max-width: var(--measure);
  margin: var(--space-5) 0 0;
}

.phosphor-screen {
  display: block;
  margin: 0;
  padding: var(--space-4) 18px;
  border-radius: var(--radius-md);
  background: #1a1000;
  color: #ffb000;
  font-family: Menlo, ui-monospace, "SF Mono", monospace;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  white-space: pre-wrap;
}

/* A colour sample beside a label set in the screen's foreground colour,
   so a low-contrast colour is shown without being used for text. */
.swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.35em;
  border: 1px solid currentColor;
  border-radius: 2px;
  vertical-align: -0.08em;
}

.swatch > span {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
}

.phosphor-dim { color: #aa8800; }
.phosphor-fg { color: #ffb000; }
.phosphor-bold { color: #ffd066; font-weight: 700; }
.phosphor-low { color: #332200; }
.phosphor-high { color: #ffe099; }
.ansi-red { color: #ff6622; }
.ansi-green { color: #88aa00; }
.ansi-yellow { color: #ffb000; }
.ansi-blue { color: #cc8844; }
.ansi-magenta { color: #dd7744; }
.ansi-cyan { color: #aaaa33; }

.gas-plasma .phosphor-screen {
  background: #1a0a00;
  color: #ff8c00;
  font-family: var(--mono);
}

.gas-plasma .phosphor-dim { color: #c46a10; }
.gas-plasma .phosphor-fg { color: #ff8c00; }
.gas-plasma .phosphor-bold { color: #ffd2a6; }
.gas-plasma .phosphor-low { color: #4d2600; }
.gas-plasma .phosphor-high { color: #fff0db; }
.gas-plasma .ansi-red { color: #ff4500; }
.gas-plasma .ansi-green { color: #8b9a00; }
.gas-plasma .ansi-yellow { color: #ffb347; }
.gas-plasma .ansi-blue { color: #cc7a00; }
.gas-plasma .ansi-magenta { color: #ff6b6b; }
.gas-plasma .ansi-cyan { color: #d4a017; }

.p1pw .phosphor-screen {
  background: #f5f5f0;
  color: #1a1a1a;
  font-family: var(--mono);
}

.p1pw .phosphor-dim { color: #555555; }
.p1pw .phosphor-fg { color: #1a1a1a; }
.p1pw .phosphor-bold { color: #000000; }
.p1pw .phosphor-low { color: #333333; }
.p1pw .ansi-red { color: #c41a16; }
.p1pw .ansi-green { color: #007400; }
.p1pw .ansi-yellow { color: #826b28; }
.p1pw .ansi-blue { color: #0000d6; }
.p1pw .ansi-magenta { color: #a90d91; }
.p1pw .ansi-cyan { color: #3e8a89; }

.wordperfectblue .phosphor-screen {
  background: #00007b;
  color: #ffffff;
  font-family: Courier, "Courier New", monospace;
}

.wordperfectblue .phosphor-dim { color: #8888cc; }
.wordperfectblue .phosphor-fg { color: #ffffff; }
.wordperfectblue .phosphor-bold { color: #e0e8ff; }
.wordperfectblue .ansi-red { color: #cc4444; }
.wordperfectblue .ansi-green { color: #44bb44; }
.wordperfectblue .ansi-yellow { color: #cccc44; }
.wordperfectblue .ansi-blue { color: #5577dd; }
.wordperfectblue .ansi-magenta { color: #bb55bb; }
.wordperfectblue .ansi-cyan { color: #44bbbb; }

.ib-dark .phosphor-screen {
  background: #161616;
  color: #ffffff;
}

.ib-light .phosphor-screen {
  background: #ffffff;
  color: #161616;
  box-shadow: inset 0 0 0 0.5px var(--separator);
}

.ib-dark .ib-keyword { color: #be95ff; }
.ib-dark .ib-string { color: #42be65; }
.ib-dark .ib-function { color: #78a9ff; }
.ib-dark .ib-class { color: #ff7eb6; }
.ib-dark .ib-number { color: #ff8389; }
.ib-light .ib-keyword { color: #8a3ffc; }
.ib-light .ib-string { color: #198038; }
.ib-light .ib-function { color: #0043ce; }
.ib-light .ib-class { color: #9f1853; }
.ib-light .ib-number { color: #da1e28; }
.ib-accent { color: #0f62fe; }

/* Footer */

.colophon {
  border-top: 0.5px solid var(--separator);
  color: var(--secondary);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.colophon .page {
  padding-top: var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
}

.colophon p {
  margin: 0 0 var(--space-2);
}

/* Motion */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .card:hover {
    transform: none;
  }
}

/* Print */

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --card: #ffffff;
    --label: #000000;
    --secondary: #333333;
    --blue: #000000;
    --card-shadow: none;
  }

  body {
    display: block;
    font-size: 11pt;
  }

  .skip,
  .site-nav,
  .actions,
  .back,
  video {
    display: none;
  }

  .topbar {
    position: static;
    background: none;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .page,
  .topbar-inner {
    width: 100%;
    padding: 0;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10pt;
  }

  .card,
  .facts section,
  .terms,
  .table-wrap,
  details {
    border: 0.5pt solid #999999;
  }

  .card,
  .shot,
  .phosphor,
  .facts section,
  .terms-table tr {
    break-inside: avoid;
  }

  .section-label {
    break-after: avoid;
  }

  .card-preview,
  .phosphor-screen,
  .badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-weight: 400;
    overflow-wrap: anywhere;
  }

  .external::after {
    background: none;
    -webkit-mask: none;
    mask: none;
    width: auto;
    height: auto;
    opacity: 1;
  }
}
