/* The pages for servers, rooms and the market. Tokens and buttons come from site.css. */

.catalog { min-height: 62vh; padding-block: clamp(36px, 6vw, 72px) clamp(56px, 8vw, 104px); }

.catalog-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px;
  margin-bottom: clamp(26px, 4vw, 44px);
}
.catalog-head > div { max-width: 720px; }
.catalog-head h1 { font: 700 clamp(30px, 4.4vw, 52px)/1.12 var(--font-title); }
.catalog-login { font-weight: 700; text-underline-offset: 4px; }

.js-only { display: none !important; }
.js .js-only { display: revert !important; }
.js .btn.js-only { display: inline-flex !important; }

/* ---------- States that are not a list ---------- */

.catalog-state {
  display: grid; justify-items: start; gap: 10px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px dashed var(--line-2); border-radius: 16px;
}
.catalog-state h2 { font: 700 clamp(18px, 2.2vw, 24px)/1.25 var(--font-title); }
.catalog-state p { max-width: 42em; color: var(--text-2); }
.catalog-state-bad { border: 1px solid var(--bad); background: var(--bad-bg); }
.catalog-state-bad p { color: var(--text); }

.catalog-warning {
  margin-bottom: 18px; padding: 12px 16px; border-radius: 10px;
  background: var(--wait-bg); color: var(--text); font-size: 14px;
}

/* ---------- Shared parts of a row ---------- */

.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row-title h2 { min-width: 0; font: 700 18px/1.3 var(--font-title); overflow-wrap: anywhere; }
.row-about { margin-top: 10px; color: var(--text-2); font-size: 15px; white-space: pre-line; }

.chip-premium { background: var(--accent); color: var(--accent-text); }
.chip-approval { background: var(--wait-bg); color: var(--wait); }
.chip-open { background: var(--ok-bg); color: var(--ok); }

/* ---------- Servers ---------- */

.server-list { display: grid; gap: 12px; }
.server-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: start;
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
}
.server-row-premium { border-color: rgba(255, 122, 47, .55); }
.server-main { min-width: 0; }

.address-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.address-line code {
  min-width: 0; padding: 5px 10px; border-radius: 6px;
  background: var(--bg-deep); color: var(--text); overflow-wrap: anywhere;
}

.server-facts { display: grid; grid-template-columns: repeat(2, minmax(84px, auto)); gap: 12px 26px; }
.server-facts dt, .room-facts dt { color: var(--text-3); font-size: 13px; }
.server-facts dd, .room-facts dd { font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }

.state { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.state::before { content: ''; flex: none; width: 10px; height: 10px; background: var(--line-2); }
.state-on { color: var(--ok); }
.state-on::before { background: var(--ok); }

/* ---------- Rooms ---------- */

.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.room-card {
  display: flex; flex-direction: column; gap: 16px; min-width: 0;
  padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
}
.room-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 12px; }
.room-action { display: grid; justify-items: start; gap: 12px; margin-top: auto; }
.room-own { color: var(--text-3); font-size: 14px; font-weight: 700; }
.room-result:empty { display: none; }
.room-result { display: grid; gap: 8px; width: 100%; font-size: 14px; }
.room-status { color: var(--text-2); }
.room-status-ok { color: var(--ok); font-weight: 700; }
.room-status-bad, .form-error { color: var(--bad); }
.room-code { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.room-code code {
  padding: 6px 12px; border-radius: 10px; background: var(--bg-deep); color: var(--count);
  font: 700 18px/1.2 var(--font-title); letter-spacing: .1em;
}
.room-hint { color: var(--text-2); }

/* ---------- Market ---------- */

.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.pack-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  transition: border-color .16s, transform .16s var(--ease);
}
.pack-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.pack-card h2 { font: 700 18px/1.3 var(--font-title); overflow-wrap: anywhere; }
.pack-card h2 a { color: var(--text); text-decoration: none; }
/* The whole card is clickable, while screen readers still get one link: the heading. */
.pack-card h2 a::after { content: ''; position: absolute; inset: 0; border-radius: 16px; }
.pack-card h2 a:focus-visible { outline: none; }
.pack-card h2 a:focus-visible::after { outline: 2px solid var(--info); outline-offset: 2px; }
.pack-author { margin-top: 6px; color: var(--text-3); font-size: 14px; overflow-wrap: anywhere; }
.pack-meta { margin-top: 14px; color: var(--count); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.pack-card .pack-meta { margin-top: auto; padding-top: 14px; }

.pack-page { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px clamp(24px, 5vw, 64px); align-items: start; }
.pack-back { grid-column: 1 / -1; justify-self: start; font-weight: 700; text-underline-offset: 4px; }
.pack-back::before { content: '← '; }
.pack-body { min-width: 0; }
.pack-body h1 { font: 700 clamp(28px, 4vw, 46px)/1.14 var(--font-title); overflow-wrap: anywhere; }
.pack-about { display: grid; gap: 12px; margin-top: 20px; color: var(--text-2); }
.pack-about p { white-space: pre-line; }
.pack-body h2 { margin-top: 34px; font: 700 18px/1.3 var(--font-title); }
.pack-license { margin-top: 8px; color: var(--text); white-space: pre-line; }
.pack-small { margin-top: 6px; color: var(--text-3); font-size: 13px; }

.pack-side { display: grid; gap: 16px; min-width: 0; }
.pack-install {
  display: grid; justify-items: start; gap: 12px; padding: 22px;
  border: 1px solid rgba(255, 122, 47, .55); border-radius: 16px;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 122, 47, .2), transparent 62%), var(--panel);
}
.pack-install h2 { font: 700 18px/1.3 var(--font-title); }
.pack-install p { color: var(--text-2); font-size: 15px; }
.pack-side .catalog-warning { margin: 0; }

.report { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.report summary { padding: 12px 16px; color: var(--text-2); font-weight: 700; font-size: 14px; cursor: pointer; }
.report summary:hover { color: var(--text); }
.report form { display: grid; justify-items: start; gap: 8px; padding: 0 16px 16px; }
.report form[hidden] { display: none; }
.report label { font-size: 14px; font-weight: 700; }
.report textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #806c5c; border-radius: 10px;
  background: var(--bg-deep); color: var(--text); font: 16px/1.5 var(--font-text); resize: vertical;
}
.form-error { font-size: 14px; }
.form-error:empty { display: none; }
.form-ok { padding: 0 16px 16px; color: var(--ok); font-size: 14px; font-weight: 700; }

/* ---------- Pages of a list ---------- */

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; margin-top: 28px; color: var(--text-3); font-size: 14px; }

/* ---------- Mods ---------- */

.mods-tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.mods-tabs a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  color: var(--text-2); font-weight: 700; text-decoration: none;
}
.mods-tabs a:hover { background: var(--panel); color: var(--text); }
.mods-tabs a[aria-current="page"] { border-color: var(--line-2); background: var(--panel-2); color: var(--text); }

.mods-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 22px; }
.mods-field { display: flex; flex: 1 1 170px; flex-direction: column; gap: 6px; min-width: 0; }
.mods-field-search { flex: 2 1 260px; }
.mods-field-short { flex: 0 1 130px; }
.mods-field label { font-size: 14px; font-weight: 700; }
.mods-field input, .mods-field select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid #806c5c; border-radius: 10px; background: var(--bg-deep); color: var(--text);
  font: 500 16px/1.4 var(--font-text);
}
.mods-field input::placeholder { color: var(--text-3); }

.mods-count { margin-bottom: 12px; color: var(--text-2); font-size: 14px; }
.mods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.mod-card {
  position: relative; display: flex; gap: 14px; min-width: 0; padding: 18px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  transition: border-color .16s;
}
.mod-card:hover { border-color: var(--line-2); }
.mod-icon { flex: none; width: 56px; height: 56px; border-radius: 10px; background: var(--bg-deep); object-fit: cover; }
.mod-icon-empty { display: block; border: 1px solid var(--line); }
.mod-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.mod-body h2 { font: 700 16px/1.3 var(--font-title); overflow-wrap: anywhere; }
.mod-body h2 a { color: var(--text); text-decoration: none; }
.mod-body h2 a:hover { color: var(--count); }
/* The whole card is the link. */
.mod-body h2 a::after { content: ''; position: absolute; inset: 0; border-radius: 16px; }
.mod-body h2 a:focus-visible { outline: none; }
.mod-body h2 a:focus-visible::after { outline: 2px solid var(--info); outline-offset: 2px; }
.mod-author { color: var(--text-3); font-size: 13px; overflow-wrap: anywhere; }
.mod-about { color: var(--text-2); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.mod-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: auto; padding-top: 8px; color: var(--text-3); font-size: 13px; }
.mods-source { margin-top: 28px; color: var(--text-3); font-size: 13px; }

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  .server-row, .pack-page { grid-template-columns: minmax(0, 1fr); }
  .server-facts { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .pack-card:hover { transform: none; }
}

@media (forced-colors: active) {
  .state::before { background: CanvasText; }
  .state-on::before { outline: 2px solid CanvasText; outline-offset: 2px; }
}
