/* PeerSeek — all public pages */

:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #cbd5e1;
  --brand: #6d4aff;
  --accent: #14b8a6;
  --accent-strong: #ff6547;
  --border: #334155;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

a:hover {
  text-decoration: underline;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 16px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--card);
  border: 2px solid var(--accent);
  color: var(--text);
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
}

.page-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.page-lead {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.page-nav a {
  color: var(--accent);
}

#main {
  scroll-margin-top: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: none;
  display: block;
}

.brand-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.imprint-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.imprint-link:hover {
  text-decoration: underline;
}

.imprint-link[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
}

.content-wrap {
  max-width: 900px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.intro {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.55;
}

.intro-tight {
  margin-bottom: 4px;
}

h2 {
  margin: 18px 0 10px;
  font-size: 1.1rem;
}

h2:first-child {
  margin-top: 0;
}

h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

h3:first-child {
  margin-top: 0;
}

p,
li {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 10px;
}

ul {
  margin: 0 0 10px;
  padding-left: 1.25rem;
}

address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.55;
  margin: 0 0 12px;
}

.note-strong {
  color: var(--text);
  font-weight: 600;
}

.content-wrap .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-top: 14px;
}

input,
select,
button {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  padding: 10px 12px;
}

button {
  cursor: pointer;
}

/* --- Search / home (index) --- */

.page-search .container {
  padding-bottom: 16px;
}

.page-search .site-hero {
  align-items: center;
  margin-bottom: 14px;
}

.page-search .site-hero-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  flex: 1;
  min-width: 0;
}

.page-search .site-hero-title .page-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
}

.page-search .brand-sep {
  color: var(--muted);
  font-weight: 400;
  user-select: none;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.search-wrap {
  position: relative;
  display: grid;
  align-items: center;
}

.search-wrap input {
  padding-right: 48px;
}

.suggest-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.suggest-list [role="option"] {
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.35;
}

.suggest-list [role="option"].is-active,
.suggest-list [role="option"]:hover {
  background: rgba(59, 130, 246, 0.18);
  color: var(--text);
}

.suggest-list [role="option"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.clear-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  background: var(--accent);
  color: var(--text);
  font-weight: 700;
  font-size: larger;
  line-height: 1;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.clear-btn.show {
  display: inline-flex;
}

#searchBtn {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

#searchBtn.is-loading {
  cursor: wait;
  opacity: 0.88;
}

#searchBtn.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: peerseek-spin 0.75s linear infinite;
}

#resultsRegion.is-loading .home-rails {
  opacity: 0.45;
  pointer-events: none;
}

#resultsRegion.is-loading-more .load-more-wrap {
  opacity: 1;
}

#loadMoreBtn.is-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: peerseek-spin 0.75s linear infinite;
}

#loadMoreBtn.is-loading {
  cursor: wait;
}

article.card-skeleton {
  pointer-events: none;
  border-color: rgba(148, 163, 184, 0.2);
}

.card-skeleton-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(
    110deg,
    #1e293b 8%,
    #334155 18%,
    #1e293b 33%
  );
  background-size: 200% 100%;
  animation: peerseek-shimmer 1.4s ease-in-out infinite;
}

.card-skeleton-body {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.card-skeleton-line {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(
    110deg,
    #1e293b 8%,
    #334155 18%,
    #1e293b 33%
  );
  background-size: 200% 100%;
  animation: peerseek-shimmer 1.4s ease-in-out infinite;
}

.card-skeleton-line--title {
  height: 14px;
  width: 92%;
}

.card-skeleton-line--short {
  width: 55%;
}

@keyframes peerseek-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes peerseek-shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #searchBtn.is-loading::before,
  #loadMoreBtn.is-loading::before {
    animation: none;
    border-top-color: var(--accent);
  }

  .card-skeleton-thumb,
  .card-skeleton-line {
    animation: none;
    background: #1e293b;
  }
}

.filters {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.filters.open {
  display: grid;
}

.filters-reset {
  grid-column: 1 / -1;
  justify-self: start;
}

.language-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.language-hint[hidden] {
  display: none !important;
}

.language-hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-btn {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.home-rails {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
  min-width: 0;
}

.home-rail {
  min-width: 0;
  max-width: 100%;
}

.home-rail-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.home-rail-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 4px;
  padding-inline-end: max(16px, env(safe-area-inset-right, 0px));
  scroll-snap-type: x proximity;
  scroll-padding-inline-end: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.home-rail-track article.card {
  flex: 0 0 min(240px, 78vw);
  scroll-snap-align: start;
}

.home-rail-track .title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .home-rail-track {
    scroll-behavior: auto;
  }
}

article.card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  color: var(--muted);
  position: relative;
}

a.card-hit {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.card-hit:hover {
  text-decoration: none;
}

a.card-hit:focus-visible {
  outline-offset: 4px;
}

a.card-hit img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0b1220;
}

a.card-hit img.is-placeholder {
  object-fit: cover;
  object-position: center;
}

.card-thumb {
  position: relative;
}

.duration-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: #f8fafc;
  background: rgba(2, 6, 23, 0.82);
  pointer-events: none;
}

.meta {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.title {
  color: var(--accent);
  font-weight: 700;
  line-height: 1.3;
}

.sub,
.stats {
  font-size: 12px;
  color: var(--muted);
}

.why {
  font-size: 12px;
  color: #94a3b8;
}

.card-seen .title {
  opacity: 0.8;
}

.sub {
  position: relative;
  padding: 0 46px 10px 10px;
}

.sub-links {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.sub-sep {
  user-select: none;
  white-space: pre;
}

.sub-link {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  vertical-align: baseline;
}

.sub-link:hover {
  color: var(--text);
}

.sub-link:visited {
  color: var(--accent);
}

.sub-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.follow-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(2, 6, 23, 0.35);
}

.follow-btn:hover {
  background: rgba(56, 189, 248, 0.24);
}

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

.follow-btn.is-syncing {
  opacity: 0.55;
  cursor: wait;
}

.home-rails.is-syncing {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.empty {
  margin-top: 20px;
  color: var(--muted);
}

.load-more-wrap {
  margin-top: 16px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.load-more-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

#loadMoreBtn {
  border-color: var(--accent);
  min-width: 160px;
}

.nsfw-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.nsfw-toggle input {
  width: auto;
  margin: 10px 10px;
  cursor: pointer;
}

.follow-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.follow-toggle input {
  width: auto;
  margin: 10px 10px;
  cursor: pointer;
}

.scroll-top-btn {
  display: none;
}

/* --- FAQ --- */

.faq-item {
  margin-bottom: 20px;
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-body {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 10px;
  padding: 0 0 0 16px;
}

.faq-body code {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
  color: var(--accent);
}

.faq-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.faq-body th,
.faq-body td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.faq-body caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 6px;
}

.faq-body th {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 700px) {
  .scroll-top-btn {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .scroll-top-btn.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .filters.open {
    grid-template-columns: 1fr;
  }

  .page-search .site-hero {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .page-search .site-hero-title .brand-sep,
  .page-search .site-hero-title .page-title {
    display: none;
  }

  .page-search .site-hero-title {
    flex-basis: auto;
  }

  .sub {
    padding-right: 50px;
  }

  .follow-btn {
    width: 32px;
    height: 32px;
    right: 9px;
    bottom: 9px;
  }

  .home-rails {
    margin-bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .scroll-top-btn {
    transition: none;
  }
}