/* Tokens and patterns follow www.mattdrummond.ca (assets/css/main.css). */
:root {
  color-scheme: light dark;
  --accent:  #fa7c00;
  --bg:      #f8f7f4;
  --fg:      #1a1917;
  --muted:   #6b6863;
  --rule:    rgba(0, 0, 0, .1);
  --hover-bg: rgba(0, 0, 0, .04);
  --code-bg: rgba(0, 0, 0, .06);
  --font-display: 'IBM Plex Serif', Georgia, serif;
  --font-ui:      'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 5vw, 64px);
  --maxw:   680px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #111110;
    --fg:       #edecea;
    --muted:    #908d89;
    --rule:     rgba(255, 255, 255, .1);
    --hover-bg: rgba(255, 255, 255, .05);
    --code-bg:  rgba(255, 255, 255, .07);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--fg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

main {
  padding: clamp(48px, 10vh, 96px) var(--gutter);
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin: 0 auto;
}

/* ─── Header ─────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2em;
  transition: color 120ms ease;
}
.back-link:hover, .back-link:focus-visible { color: var(--accent); }

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.5em;
}
.lede { color: var(--muted); margin-bottom: 1.5em; }

hr { border: none; border-top: 1px solid var(--rule); }

.group-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2em 0 0.75em;
}
hr + .group-label { margin-top: 1.25em; }

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  background-color: var(--code-bg);
  padding: 1em 1.2em;
  border-radius: 6px;
  overflow-x: auto;
}
code { font-family: var(--font-mono); }

/* ─── Rows (the nav-link pattern of the main site) ───── */
nav { display: flex; flex-direction: column; }
nav a {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  column-gap: 1em;
  padding: 0.9em 0.5em;
  margin: 0 -0.5em;
  border-bottom: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--fg);
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}
nav a:first-of-type { border-top: 1px solid var(--rule); }
nav a:hover, nav a:focus-visible { background-color: var(--hover-bg); color: var(--accent); }
nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
nav img { width: 40px; height: 40px; display: block; }
.row-text { min-width: 0; display: flex; flex-direction: column; }
.link-name {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.ver { color: var(--muted); font-size: 0.8em; font-weight: 400; display: inline-block; margin-left: 0.4em; }
.link-desc { color: var(--muted); font-size: 0.875rem; transition: color 120ms ease; }
.row-id {
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
nav a:hover .link-desc, nav a:focus-visible .link-desc { color: var(--accent); opacity: 0.7; }
.link-arrow {
  font-size: 0.9em;
  color: var(--muted);
  user-select: none;
  transition: color 120ms ease, transform 120ms ease;
}
nav a:hover .link-arrow, nav a:focus-visible .link-arrow { color: var(--accent); transform: translateY(2px); }

.note { color: var(--muted); font-size: 0.875rem; margin-top: 0.75em; }
.note code { font-size: 0.85em; }

footer { margin-top: 3em; color: var(--muted); font-size: 0.8rem; }
footer a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
footer a:hover { color: var(--accent); }

/* ─── Entrance ───────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .back-link, .page-title, .lede, hr, .group-label, pre, nav a, .note {
    animation: up 0.22s ease both;
  }
  .page-title, .lede { animation-delay: 20ms; }
  hr, pre            { animation-delay: 30ms; }
  .group-label       { animation-delay: 35ms; }
  @keyframes up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ─── App page (layout modelled on Flathub and Bazaar app pages) ─── */
.app-head {
  display: grid;
  grid-template-columns: 96px 1fr;
  column-gap: 1.25em;
  align-items: center;
  margin-bottom: 1.5em;
}
.app-head img { width: 96px; height: 96px; display: block; }
.app-head .page-title { margin-bottom: 0.1em; }
.app-dev { color: var(--muted); font-size: 0.9rem; }
.app-summary { font-size: 1.1rem; margin-top: 0.25em; }

.install {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  align-items: center;
  margin-bottom: 1.5em;
}
.button {
  display: inline-block;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.45em 1.1em;
  transition: filter 120ms ease;
}
.button:hover, .button:focus-visible { filter: brightness(1.1); }
.button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.button.quiet { background: transparent; color: var(--fg); border-color: var(--rule); }
.button.quiet:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.install .meta { color: var(--muted); font-size: 0.85rem; }

.shots {
  display: flex;
  gap: 1em;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75em;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  scroll-padding: 0 var(--gutter);
}
.shots figure { flex: 0 0 auto; max-width: 92%; scroll-snap-align: start; }
.shots img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.shots figcaption { color: var(--muted); font-size: 0.8rem; margin-top: 0.4em; }

.prose { font-size: 1rem; }
.prose > * + * { margin-top: 0.9em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.3em; }
.prose code {
  font-size: 0.875em;
  background-color: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.release-head { display: flex; gap: 0.75em; align-items: baseline; margin-bottom: 0.5em; }
.release-head strong { font-weight: 500; }
.release-head span { color: var(--muted); font-size: 0.85rem; }

dl.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.5em;
  border-top: 1px solid var(--rule);
}
dl.details dt, dl.details dd {
  padding: 0.6em 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
dl.details dt { color: var(--muted); font-size: 0.875rem; }
dl.details dd { overflow-wrap: anywhere; }
dl.details a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
dl.details a:hover { color: var(--accent); }

ul.perms { list-style: none; border-top: 1px solid var(--rule); }
ul.perms li {
  display: grid;
  grid-template-columns: 1.5em 1fr;
  gap: 0.5em;
  padding: 0.6em 0;
  border-bottom: 1px solid var(--rule);
}
ul.perms .mark { color: var(--muted); text-align: center; }
ul.perms .warn { color: var(--accent); }
ul.perms small { display: block; color: var(--muted); font-size: 0.8rem; }

@media (max-width: 480px) {
  .app-head { grid-template-columns: 64px 1fr; }
  .app-head img { width: 64px; height: 64px; }
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { border-bottom: none; padding-bottom: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .app-head, .install, .shots, .prose, dl.details, ul.perms { animation: up 0.22s ease both; }
  .install { animation-delay: 20ms; }
  .shots   { animation-delay: 30ms; }
}
