@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap");

:root {
  --color-bg: #080D18;
  --color-surface: #0D1728;
  --color-surface-elevated: #14233B;
  --color-blue-deep: #142B52;
  --color-blue-interactive: #244A80;
  --color-accent: #4F8FEA;
  --color-accent-hover: #3A7DDB;

  --color-text: #E7EDF7;
  --color-text-muted: #9BAAC2;
  --color-border: #23334D;

  --color-success: #6BCB98;
  --color-warning: #E5BD70;
  --color-neutral: #8491A6;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --header-h: 60px;
  --transition: 160ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 12px;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 12px; }

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

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

.visually-hidden {
  position: absolute !important;
  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: 16px;
  top: -48px;
  background: var(--color-accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

main { flex: 1; }

.hidden { display: none !important; }
.muted { color: var(--color-text-muted); }
.small { font-size: 13px; }
.missing { color: var(--color-text-muted); font-style: italic; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand img { display: block; height: 28px; width: auto; }
.brand:hover { text-decoration: none; }

.search {
  flex: 1;
  max-width: 560px;
  position: relative;
}

.search input {
  width: 100%;
  height: 38px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 14px 0 38px;
  font: inherit;
  transition: border-color var(--transition);
}

.search input::placeholder { color: var(--color-neutral); }

.search input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border: 2px solid var(--color-neutral);
  border-radius: 50%;
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 75%;
  width: 6px;
  height: 2px;
  background: var(--color-neutral);
  transform: rotate(45deg);
  pointer-events: none;
}

/* Hides the native clear button so the design stays consistent */
.search input::-webkit-search-cancel-button { filter: invert(0.8); }

.site-nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.site-nav a {
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.site-nav a:hover {
  color: var(--color-text);
  background: var(--color-surface-elevated);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-surface-elevated);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }

.btn-secondary { background: var(--color-blue-interactive); color: var(--color-text); }
.btn-secondary:hover { background: #2D5A97; }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-accent); }

button.link-button {
  background: none;
  border: none;
  color: var(--color-accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

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

/* ---------- Hero and sections ---------- */

.hero {
  padding: 64px 0 48px;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}

.hero h1 { max-width: 20ch; }

.lead {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 60ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 36px 0 0;
}

.stats div { min-width: 120px; }

.stats dt {
  color: var(--color-text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats dd {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.section { padding: 48px 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 { margin: 0; }

.type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.type-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--color-text);
  transition: border-color var(--transition);
}

.type-card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.type-card h3 { margin-bottom: 6px; }
.type-card p { color: var(--color-text-muted); font-size: 14px; margin: 0; }

/* ---------- Catalog layout ---------- */

.catalog-page { padding: 32px 0 64px; }

.catalog-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sidebar-head h2 { margin: 0; font-size: 1rem; }

.filter-group {
  border: 0;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--color-border);
  min-width: 0;
}

.filter-group legend {
  font-weight: 600;
  font-size: 14px;
  padding: 0;
  margin-bottom: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 14px;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.check .count {
  margin-left: auto;
  color: var(--color-neutral);
  font-size: 12px;
}

.results-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.results-head .count-text {
  color: var(--color-text-muted);
  font-size: 14px;
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.sort-field select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font: inherit;
}

.sort-field select:focus { outline: none; border-color: var(--color-accent); }

/* ---------- Cards ---------- */

.grid-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.card {
  position: relative;
  display: flex;
  gap: 16px;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color var(--transition);
}

.card:hover,
.card:focus-within { border-color: var(--color-accent); }

.card-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-blue-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-icon span {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.card-main { min-width: 0; flex: 1; }

.card-title {
  font-size: 1.05rem;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}

.card-title a { color: var(--color-text); }

/* Makes the whole card clickable through the title link */
.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-meta {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.card-desc {
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-bg);
  white-space: nowrap;
}

.pill-muted { color: var(--color-neutral); }
.pill-dashed { border-style: dashed; }

.pill.status { background: transparent; font-weight: 600; }
.pill.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-available { color: var(--color-success); border-color: currentColor; }
.status-development { color: var(--color-warning); border-color: currentColor; }
.status-archived { color: var(--color-neutral); border-color: currentColor; }

/* ---------- States ---------- */

.loading {
  color: var(--color-text-muted);
  text-align: center;
  padding: 48px 0;
}

.state-box {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 48px auto;
}

.state-box h3,
.state-box .state-title { color: var(--color-text); font-size: 1.25rem; }

.state-box .btn { margin-top: 12px; }

/* ---------- Project page ---------- */

.breadcrumb { padding-top: 24px; font-size: 14px; color: var(--color-text-muted); }

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--color-neutral);
}

/* Full cover: natural proportions, no cropping and no size reduction */
.project-cover {
  width: 100%;
  max-width: 480px;
  margin: 0 0 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

.project-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
}

.project-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 28px;
}

.project-game { color: var(--color-text-muted); margin: 0 0 4px; }
.project-header h1 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); margin-bottom: 12px; }

.project-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  padding-bottom: 64px;
  align-items: start;
}

.block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.block:first-child { margin-top: 0; }

.plain-list { padding-left: 18px; margin: 0; }
.plain-list li { margin-bottom: 6px; overflow-wrap: anywhere; }

.facts {
  margin: 0 0 20px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: grid;
  gap: 14px;
}

.facts dt {
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.facts dd { margin: 2px 0 0; font-size: 14px; }

.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

.link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}

.link-row:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.notice {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warning);
  background: var(--color-surface);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ---------- Prose pages (About, 404) ---------- */

.page-intro {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--color-border);
}

.page-intro p { color: var(--color-text-muted); max-width: 65ch; margin: 0; }

.prose {
  padding: 32px 0 64px;
  max-width: 740px;
}

.prose h2 { margin-top: 36px; }
.prose h3 { margin-top: 20px; font-size: 1rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 32px 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.footer-logo img { display: block; height: 32px; width: auto; }

.footer-links {
  display: flex;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links a { color: var(--color-text-muted); }
.footer-links a:hover { color: var(--color-text); }

.footer-copy { margin: 0; width: 100%; font-size: 13px; }

.footer-note {
  width: 100%;
  margin: 0;
  font-size: 13px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

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

@media (max-width: 960px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .project-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .container, .header-inner { padding: 0 16px; }
  .header-inner { gap: 12px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .brand { order: 1; }
  .site-nav { order: 2; margin-left: auto; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .hero { padding: 44px 0 36px; }
  .grid-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}