/* dhtcrawler4 stylesheet. Served from the binary; no fonts, images or other
   external resources. Dark by default; the light theme applies when the
   server renders `data-theme="light"` (stored from POST /theme in a
   cookie). No JavaScript. */

:root {
  color-scheme: dark;
  --bg: #0f1216;
  --surface: #181c22;
  --text: #e4e7eb;
  --muted: #9ba5b0;
  --border: #343b44;
  --link: #8ab4f8;
  --link-visited: #c9a2f7;
  --accent: #8ab4f8;
  --accent-text: #0b1220;
  --focus: #ffb454;
  --notice-bg: #2a2410;
  --notice-border: #8a6d00;
  --error: #f2b8b5;
  --radius: 0.5rem;
  --measure: 60rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans", "Microsoft YaHei",
    sans-serif;
  font-size: 100%;
  line-height: 1.5;
}

/* The light theme applies when the server renders `data-theme="light"`
   on the document element (the visitor's stored choice). Without it the
   dark values from `:root` apply, so the page is dark with no JavaScript. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f4f6f8;
  --text: #1a1e23;
  --muted: #56606b;
  --border: #d0d7de;
  --link: #0a58ca;
  --link-visited: #6f42c1;
  --accent: #0a58ca;
  --accent-text: #ffffff;
  --focus: #e8710a;
  --notice-bg: #fff8e1;
  --notice-border: #e0b000;
  --error: #b3261e;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

main {
  flex: 1 0 auto;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.5rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

bdi {
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: -100vw;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
}

.skip-link:focus {
  left: 0.5rem;
}

/* Header and footer */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand,
.brand:visited {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.theme-switch {
  margin-left: auto;
}

.theme-switch button {
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.site-footer {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.site-footer p {
  margin: 0;
  padding: 1rem;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Search forms */

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 20rem;
  max-width: 40rem;
}

.search-form label {
  flex-basis: 100%;
  font-weight: 600;
}

.search-form.compact label {
  flex-basis: auto;
}

input,
textarea,
button {
  font: inherit;
  color: inherit;
}

input[type="search"],
input[type="text"],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-form input[type="search"] {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
}

button,
.button {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:visited {
  color: var(--accent-text);
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-form .hint {
  flex-basis: 100%;
  margin: 0;
}

/* Home page */

.hero {
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-size: 2.25rem;
}

.tagline {
  color: var(--muted);
  font-size: 1.1rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  margin-top: 2rem;
}

.stats dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.stats dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.muted,
.stats-missing {
  color: var(--muted);
}

/* Results */

.results-summary {
  color: var(--muted);
}

.sort {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 1rem;
}

.sort ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sort [aria-current] {
  font-weight: 700;
}

.results {
  margin: 0;
  padding-left: 2.25rem;
}

.result {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.result-title {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.actions {
  margin: 0.25rem 0 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.empty {
  padding: 1rem 0;
}

/* Torrent page */

.torrent-name {
  font-size: 1.5rem;
}

.facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.35rem 1.5rem;
}

.facts > div {
  display: contents;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.multiline {
  white-space: pre-line;
}

.table-scroll {
  overflow-x: auto;
}

.files {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.files th,
.files td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.files th {
  background: var(--surface);
}

.files .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.files .path {
  overflow-wrap: anywhere;
}

.note {
  color: var(--muted);
}

/* Notices, forms and prose */

.notice {
  max-width: 44rem;
  padding: 1.25rem 1.5rem;
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
}

.notice h1 {
  font-size: 1.5rem;
}

.error {
  color: var(--error);
  font-weight: 600;
}

.report-form fieldset {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.report-form legend {
  padding: 0 0.25rem;
  font-weight: 600;
}

.report-form label {
  font-weight: 600;
}

.report-form .choice label {
  font-weight: normal;
}

.choice {
  padding: 0.2rem 0;
}

.prose {
  max-width: 44rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

@media (max-width: 36rem) {
  h1 {
    font-size: 1.5rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0 0;
  }

  .facts dd {
    margin-bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

@media print {
  .site-header,
  .site-footer,
  .search-form,
  .theme-switch,
  .pager,
  .sort {
    display: none;
  }
}
