/* GitHub Primer palette — light defaults, dark via prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #59636e;
  --line: #d1d9e0;
  --card: #ffffff;
  --accent: #0969da;
  --btn: #f6f8fa;
  --hover: #eff2f5;
  --shadow: 0 1px 1px 0 #1f23280a, 0 1px 2px 0 #1f232808;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #8b949e;
    --line: #30363d;
    --card: #161b22;
    --accent: #4493f8;
    --btn: #21262d;
    --hover: #30363d;
    --shadow: 0 1px 1px 0 #01040999, 0 1px 3px 0 #01040999;
  }
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

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

/* Header */
header {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 24px 8px;
}

header h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.logo {
  flex: none;
  width: 40px;
  height: 40px;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
}

header p {
  margin: 0;
  color: var(--muted);
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 8px;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.jump a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.jump a:hover {
  background: var(--hover);
}

.jump a:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-count {
  color: var(--muted);
}

/* GitHub-style alerts, mimicking > [!NOTE] / [!TIP] callouts. */
.alert-region {
  max-width: 920px;
  margin: 20px auto 0;
  padding: 0 24px;
}

.alert {
  padding: 8px 16px;
  border-left: 4px solid var(--alert-accent);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
}

.alert p {
  margin: 0 0 16px;
}

.alert > :last-child {
  margin-bottom: 0;
}

.alert .alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  line-height: 1;
  color: var(--alert-accent);
}

.alert-icon {
  fill: currentColor;
}

.alert-note {
  --alert-accent: var(--accent);
}

.alert-tip {
  --alert-accent: #1a7f37;
}

@media (prefers-color-scheme: dark) {
  .alert-tip {
    --alert-accent: #3fb950;
  }
}

/* Card grid */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
}

.group {
  scroll-margin-top: 14px;
}

.group + .group {
  margin-top: 32px;
}

.group-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.group-note {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

/* Alert shown after a section's cards. */
.group .alert {
  margin-top: 24px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  scroll-margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card.current-target {
  animation: target-highlight 1.6s ease-out;
}

@keyframes target-highlight {
  0%, 35% {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
  }

  100% {
    border-color: var(--line);
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card.current-target {
    animation-timing-function: steps(1, end);
  }
}

.card h2 {
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.ver {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.permalink {
  color: inherit;
  text-decoration: none;
}

.permalink:hover,
.permalink:focus-visible {
  text-decoration: underline;
}

.scheme {
  margin-left: auto;
  align-self: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.preview {
  margin: 0 0 16px;
}

/* Radios drive the tab state; kept accessible but visually hidden. */
.preview .tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Compact Light/Dark switch pinned to the card's top-right, opposite the name. */
.tabs {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 1;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
}

.tabs label {
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  padding: 1px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.tab-input.light:checked ~ .tabs label[for$="-light"],
.tab-input.dark:checked ~ .tabs label[for$="-dark"] {
  color: var(--fg);
  background: var(--hover);
}

.tab-input:focus-visible ~ .tabs label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.frames {
  border-radius: 6px;
  background: var(--hover);
}

.frame {
  display: none;
  width: 100%;
  height: auto;
  aspect-ratio: 688 / 168;
  object-fit: cover;
  vertical-align: top;
}

.preview.single .frame,
.tab-input.light:checked ~ .frames .frame.light,
.tab-input.dark:checked ~ .frames .frame.dark {
  display: block;
}

.desc {
  margin: 0 0 12px;
  font-size: 14px;
}

.meta {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.meta code {
  font-size: 11.5px;
}

/* Action buttons */
.actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--btn);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--hover);
}

/* Monochrome icons, tinted with the button's text color via mask. */
.icon {
  width: 13px;
  height: 13px;
  background: currentColor;
  opacity: 0.6;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-install {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1.75a.75.75 0 0 1 .75.75v5.19l1.72-1.72a.75.75 0 1 1 1.06 1.06L8.53 10.28a.75.75 0 0 1-1.06 0L4.47 7.03a.75.75 0 0 1 1.06-1.06l1.72 1.72V2.5A.75.75 0 0 1 8 1.75Z'/><path d='M2.75 10.5a.75.75 0 0 1 .75.75v1c0 .14.11.25.25.25h8.5a.25.25 0 0 0 .25-.25v-1a.75.75 0 0 1 1.5 0v1A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-1a.75.75 0 0 1 .75-.75Z'/></svg>");
}

.icon-link {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6.75 3.5a.75.75 0 0 1 0 1.5H4.25a.75.75 0 0 0-.75.75v6.25c0 .414.336.75.75.75h6.25a.75.75 0 0 0 .75-.75V9.25a.75.75 0 0 1 1.5 0v2.75A2.25 2.25 0 0 1 10.5 14.25H4.25A2.25 2.25 0 0 1 2 12V5.75A2.25 2.25 0 0 1 4.25 3.5h2.5Z'/><path d='M9.5 2.5a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0V4.56L8.28 8.78a.75.75 0 0 1-1.06-1.06l4.22-4.22h-1.19a.75.75 0 0 1-.75-.75Z'/></svg>");
}

/* Footer */
footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
