/* Rusti.fi — exact dark theme for the current server-list markup
   Targets: #rusto-filters, .rusto-server-card and the classes supplied by the site.
   Load after the existing stylesheet.
*/

:root {
  color-scheme: dark;
  --rusti-bg: #0a1017;
  --rusti-bg-soft: #0d151e;
  --rusti-panel: #111a24;
  --rusti-panel-hover: #15212d;
  --rusti-input: #0d1620;
  --rusti-border: #263443;
  --rusti-border-hover: #405266;
  --rusti-text: #f5f7fa;
  --rusti-muted: #94a0ad;
  /* Lightened from the original #6f7b88 (~3.98:1 on the card background,
     just under WCAG AA's 4.5:1 for normal text — used for real informational
     text like "Last checked X ago", not purely decorative) to ~5.55:1. */
  --rusti-muted-2: #8794a1;
  --rusti-accent: #ef4c3e;
  --rusti-accent-hover: #ff624f;
  --rusti-accent-deep: #742725;
  --rusti-green: #70d66f;
  --rusti-yellow: #e9b949;
  --rusti-red: #ff675f;
  --rusti-radius: 10px;
  --rusti-radius-sm: 7px;
  --rusti-content: 1540px;
  --rusti-shadow: 0 16px 40px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }

html { background: var(--rusti-bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -10%, rgba(77, 105, 132, .14), transparent 34rem),
    linear-gradient(180deg, #091018 0%, #0b121a 45%, #0a1118 100%);
  color: var(--rusti-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.site-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 2em auto 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* -------- Page heading -------- */

h1 {
  width: min(calc(100% - 48px), var(--rusti-content));
  margin: 0;
  color: var(--rusti-text);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

/* -------- Filters -------- */

#rusto-filters.rusto-filters {
  width: min(100%, var(--rusti-content));
  margin: 0;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
  border: 1px solid var(--rusti-border);
  border-radius: var(--rusti-radius);
  background: linear-gradient(180deg, rgba(18, 28, 39, .97), rgba(14, 23, 32, .97));
  box-shadow: var(--rusti-shadow);
}

#rusto-filters > input[type="search"] {
  flex: 1 1 260px;
  min-width: 230px;
}

#rusto-filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  color: #d9e0e7;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

#rusto-filters label:has(input[type="number"]),
#rusto-filters label:has(select) {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
  min-height: auto;
}

#rusto-filters input,
#rusto-filters select {
  font: inherit;
}

#rusto-filters input[type="search"],
#rusto-filters input[type="number"],
#rusto-filters select {
  height: 42px;
  border: 1px solid #304050;
  border-radius: var(--rusti-radius-sm);
  outline: 0;
  background: var(--rusti-input);
  color: var(--rusti-text);
  padding: 0 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#rusto-filters input[type="search"]::placeholder {
  color: #73808e;
}

#rusto-filters input[type="number"] {
  width: 110px;
}

#rusto-filters select {
  min-width: 145px;
  cursor: pointer;
}

#rusto-filters input[type="search"]:focus,
#rusto-filters input[type="number"]:focus,
#rusto-filters select:focus {
  border-color: rgba(239, 76, 62, .88);
  box-shadow: 0 0 0 3px rgba(239, 76, 62, .13);
  background: #101b27;
}

#rusto-filters input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--rusti-accent);
  cursor: pointer;
}

/* -------- Server-card parent --------
   Your bare screenshot indicates cards are sibling articles. This makes the
   common wrappers work without requiring a new class in PHP.
*/

:where(main, .site-main, #content, .content, .entry-content):has(> .rusto-server-card) {
  width: min(calc(100% - 48px), var(--rusti-content));
  margin-inline: auto;
}

:where(main, .site-main, #content, .content, .entry-content):has(> .rusto-server-card) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
  align-items: stretch;
}

/* If there is a dedicated wrapper around the articles, give it this class.
   This is preferable to :has() for maximum compatibility. */
.rusto-server-grid {
  width: min(calc(100% - 48px), var(--rusti-content));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
  align-items: stretch;
}

/* -------- Server cards -------- */

.rusto-server-card {
  position: relative;
  min-width: 0;
  min-height: 270px;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rusti-border);
  border-radius: var(--rusti-radius);
  background:
    radial-gradient(circle at 100% 0%, rgba(86, 112, 137, .08), transparent 14rem),
    linear-gradient(180deg, rgba(18, 28, 39, .98), rgba(14, 23, 32, .98));
  box-shadow: 0 7px 22px rgba(0, 0, 0, .17);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.rusto-server-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--rusti-accent), #ff8057 62%, transparent);
}

.rusto-server-card::after {
  content: "ONLINE";
  align-self: flex-start;
  order: -1;
  margin: -1px 0 9px;
  padding: 3px 7px;
  border: 1px solid rgba(112, 214, 111, .14);
  border-radius: 5px;
  background: rgba(55, 145, 72, .18);
  color: #9ce6a0;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: .055em;
}

.rusto-grave-card .rusto-server-card::after {
  display: none;
}

.rusto-server-card:hover {
  transform: translateY(-2px);
  border-color: var(--rusti-border-hover);
  background:
    radial-gradient(circle at 100% 0%, rgba(97, 128, 155, .11), transparent 14rem),
    linear-gradient(180deg, rgba(21, 33, 45, .99), rgba(15, 25, 35, .99));
  box-shadow: 0 15px 34px rgba(0, 0, 0, .26);
}

.rusto-server-card h2 {
  margin: 0 0 10px;
  color: var(--rusti-accent-hover);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.3;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.rusto-server-card h2 a {
  color: inherit;
  text-decoration: none;
}

.rusto-server-card h2 a:hover {
  color: #ff7b67;
}

.rusto-server-card p {
  margin: 0;
}

.rusto-server-ping {
  color: #c7d0da;
  font-size: 13px;
}

.rusto-server-ping::before {
  content: "▥";
  margin-right: 6px;
  color: var(--rusti-muted-2);
  font-size: 12px;
}

.rusto-server-jitter {
  margin-top: 3px !important;
  font-size: 12px;
  font-weight: 750;
}

.rusto-jitter-excellent { color: var(--rusti-green); }
.rusto-jitter-good { color: #a3d96d; }
.rusto-jitter-fair { color: var(--rusti-yellow); }
.rusto-jitter-poor { color: var(--rusti-red); }

.rusto-server-players {
  margin-top: 12px !important;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.rusto-server-map {
  margin-top: 6px !important;
  color: var(--rusti-muted);
  font-size: 12px;
  font-style: italic;
}

.rusto-server-keywords {
  margin-top: 10px !important;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rusto-keyword-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 999px;
  background: linear-gradient(180deg, #84302b, #652321);
  color: #fff;
  box-shadow: inset 0 1px rgba(255, 255, 255, .04);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.rusto-server-checked,
.rusto-server-last-wipe {
  margin-top: 9px !important;
  color: var(--rusti-muted-2);
  font-size: 11px;
}

.rusto-copy {
  min-height: 34px;
  width: fit-content;
  margin-top: auto;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, .04);
  border-radius: 6px;
  background: linear-gradient(180deg, #8c302c, #702522);
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(0, 0, 0, .14);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.rusto-copy:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .12);
  background: linear-gradient(180deg, #a53932, #812b27);
}

.rusto-copy:active {
  transform: translateY(0);
}

.rusto-copy:focus-visible,
.rusto-server-card a:focus-visible,
#rusto-filters input:focus-visible,
#rusto-filters select:focus-visible {
  outline: 2px solid var(--rusti-accent-hover);
  outline-offset: 2px;
}

/* -------- Responsive -------- */

@media (max-width: 900px) {
  #rusto-filters.rusto-filters {
    align-items: stretch;
  }

  #rusto-filters > input[type="search"] {
    flex-basis: 100%;
  }
}

@media (max-width: 640px) {
  h1,
  #rusto-filters.rusto-filters,
  .rusto-server-grid,
  :where(main, .site-main, #content, .content, .entry-content):has(> .rusto-server-card) {
    width: min(100%, var(--rusti-content));
  }

  h1 {
    margin-top: 24px;
  }

  #rusto-filters.rusto-filters {
    padding: 14px;
    gap: 11px;
  }

  #rusto-filters label:has(input[type="number"]),
  #rusto-filters label:has(select) {
    width: 100%;
  }

  #rusto-filters input[type="number"],
  #rusto-filters select {
    width: 100%;
  }

  .rusto-server-grid,
  :where(main, .site-main, #content, .content, .entry-content):has(> .rusto-server-card) {
    grid-template-columns: 1fr;
  }
}

/* -------- FAQ (list page) -------- */

.rusto-faq {
  margin-top: 28px;
  padding: 20px 24px;
  background: var(--rusti-panel);
  border: 1px solid var(--rusti-border);
  border-radius: var(--rusti-radius);
  box-shadow: var(--rusti-shadow);
}

.rusto-faq h2 {
  margin: 0 0 16px;
  color: var(--rusti-text);
  font-size: 1.05rem;
}

.rusto-faq-item {
  padding: 14px 0;
  border-top: 1px solid var(--rusti-border);
}

.rusto-faq-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.rusto-faq-item h3 {
  margin: 0 0 6px;
  color: var(--rusti-text);
  font-size: 0.95rem;
  font-weight: 700;
}

.rusto-faq-item p {
  margin: 0;
  color: var(--rusti-muted-2);
  font-size: 0.88rem;
  line-height: 1.6;
}

/** Single type-post */
article.type-post {
  display: grid;
  place-items: center;
}
article header.entry-header {
  max-width: 840px;
}
article header.entry-header h1 {
  width: unset;
  margin: 0;
}
article.type-post .entry-content {
  max-width: 840px;
}

/* -------- How it works (methodology page) --------
   page.php has no <main> wrapper at all, so this page uses its own
   template (template-how-it-works.php) purely for that grid/width
   treatment — the actual prose still comes from the Page's own
   post_content via the_content(), so it stays editable from wp-admin. */

.rusto-content-page {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 48px;
}

.rusto-content-page .entry-title {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--rusti-text);
}

.rusto-content-page .entry-content {
  color: #c9d1d9;
  font-size: 1rem;
  line-height: 1.7;
}

.rusto-content-page .entry-content h2 {
  margin: 40px 0 12px;
  color: var(--rusti-text);
  font-size: 1.3rem;
  letter-spacing: -.012em;
}

.rusto-content-page .entry-content h2:first-child {
  margin-top: 0;
}

.rusto-content-page .entry-content p {
  margin: 0 0 16px;
}

.rusto-content-page .entry-content ul,
.rusto-content-page .entry-content ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
}

.rusto-content-page .entry-content li {
  margin-bottom: 8px;
}

.rusto-content-page .entry-content li::marker {
  color: var(--rusti-muted);
}

.rusto-content-page .entry-content a {
  color: var(--rusti-accent-hover);
  text-decoration: underline;
  text-decoration-color: rgba(255, 98, 79, .4);
}

.rusto-content-page .entry-content a:hover {
  text-decoration-color: var(--rusti-accent-hover);
}

.rusto-content-page .entry-content strong {
  color: var(--rusti-text);
}

@media (max-width: 640px) {
  .rusto-content-page {
    padding-left: 18px;
    padding-right: 18px;
  }
}