/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === Variables === */
:root {
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-accent: #58a6ff;
  --color-accent-hover: #79c0ff;
  --color-border: #30363d;
  --color-hero-bg: #010409;
  --color-hero-text: #f0f6fc;
  --color-hero-muted: #8b949e;
  --color-footer-bg: #010409;
  --color-footer-text: #8b949e;
  --radius: 4px;
  --max-width: 960px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial,
    sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === Nav === */
nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}

nav a {
  color: var(--color-text-muted);
  font-weight: 500;
}

nav a:hover {
  color: var(--color-text);
  text-decoration: none;
}

/* === Sections === */
section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* === App list (cards) === */
.app-list {
  display: flex;
  flex-direction: column;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.app-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--color-bg);
  border-left: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  z-index: 0;
}

.app-item:hover {
  transform: translateX(6px);
  border-left-color: var(--color-accent);
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.35);
  background: var(--color-surface);
  z-index: 1;
}

.app-icon {
  flex-shrink: 0;
  display: block;
}

.app-body {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent);
}

.app-name:hover {
  color: var(--color-accent-hover);
}

.app-desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-links {
  flex-shrink: 0;
  display: flex;
  gap: 0.375rem;
}

.install-link {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
}

.install-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  text-decoration: none;
}

.category-meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.search-box {
  margin-bottom: 1rem;
}

#search-input {
  width: 100%;
  max-width: 480px;
  padding: 0.5em 0.75em;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  box-sizing: border-box;
}

#search-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

@media (max-width: 640px) {
  .app-item {
    flex-wrap: wrap;
  }
  .app-desc {
    white-space: normal;
  }
  .app-links {
    width: 100%;
    padding-left: 3.75rem;
  }
}

/* === Back to top === */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  padding-bottom: 2px;
  opacity: 0;
  transition: opacity 0.2s, border-color 0.2s;
  z-index: 100;
  pointer-events: none;
}

#back-to-top.btt-visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* === Footer === */
footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.8125rem;
  line-height: 2;
}

footer a {
  color: var(--color-hero-text);
}

footer a:hover {
  color: var(--color-accent);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
