/* nginx autoindex pages — injected via sub_filter */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(14, 165, 233, 0.1), transparent 45%),
    var(--page-bg, #f4f4f5);
  color: var(--text, #18181b);
}

@media (prefers-color-scheme: dark) {
  body {
    --page-bg: #0c0c0e;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --card: rgba(24, 24, 27, 0.85);
    --border: rgba(255, 255, 255, 0.08);
    --link: #93c5fd;
    --link-hover: #bfdbfe;
  }
}

@media (prefers-color-scheme: light) {
  body {
    --muted: #71717a;
    --card: rgba(255, 255, 255, 0.82);
    --border: rgba(0, 0, 0, 0.06);
    --link: #2563eb;
    --link-hover: #1d4ed8;
  }
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: 0.65rem;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--link, #6366f1), transparent);
}

hr {
  display: none;
}

pre {
  margin: 0;
  padding: 1rem 1.15rem;
  max-width: 56rem;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--card, rgba(255, 255, 255, 0.82));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.06));
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  pre {
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.2),
      0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

pre a {
  color: var(--link, #2563eb);
  text-decoration: none;
  border-radius: 4px;
  padding: 0.1em 0.15em;
  margin: 0 -0.15em;
  transition: color 0.15s ease, background 0.15s ease;
}

pre a:hover {
  color: var(--link-hover, #1d4ed8);
  background: rgba(99, 102, 241, 0.1);
}

/* Parent directory — nginx still emits "../" in HTML; label shown as "Back" */
pre a[href="../"] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  font-size: 0;
  line-height: 0;
  color: var(--text);
  text-decoration: none;
  vertical-align: middle;
  border-radius: 9999px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background: linear-gradient(
    165deg,
    rgba(99, 102, 241, 0.14) 0%,
    rgba(99, 102, 241, 0.06) 100%
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 1px 2px rgba(0, 0, 0, 0.06);
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

pre a[href="../"]::before {
  content: "↑";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  color: var(--link, #2563eb);
  background: rgba(99, 102, 241, 0.12);
}

pre a[href="../"]::after {
  content: "Back";
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

@media (prefers-color-scheme: dark) {
  pre a[href="../"] {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(
      165deg,
      rgba(129, 140, 248, 0.18) 0%,
      rgba(99, 102, 241, 0.08) 100%
    );
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.04) inset,
      0 2px 8px rgba(0, 0, 0, 0.25);
  }

  pre a[href="../"]::before {
    background: rgba(147, 197, 253, 0.12);
    color: var(--link, #93c5fd);
  }
}

pre a[href="../"]:hover {
  color: var(--text);
  background: linear-gradient(
    165deg,
    rgba(99, 102, 241, 0.22) 0%,
    rgba(99, 102, 241, 0.12) 100%
  );
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 14px rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

pre a[href="../"]:hover::before {
  color: var(--link-hover, #1d4ed8);
  background: rgba(99, 102, 241, 0.2);
}

@media (prefers-color-scheme: dark) {
  pre a[href="../"]:hover {
    border-color: rgba(147, 197, 253, 0.35);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.06) inset,
      0 6px 20px rgba(0, 0, 0, 0.45);
  }

  pre a[href="../"]:hover::before {
    color: var(--link-hover, #bfdbfe);
    background: rgba(147, 197, 253, 0.18);
  }
}

pre a[href="../"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) inset;
}

pre a[href="../"]:focus-visible {
  outline: 2px solid var(--link, #6366f1);
  outline-offset: 3px;
}
