/* --- IMPORTS, VARIABLES & BASE --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0A0F19;
  --panel: #111827;
  --card: #161f30;
  --border: #374151;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { 
  box-sizing: border-box; 
}

html { 
  scroll-behavior: smooth; 
}

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0; 
  background: var(--bg); 
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { 
  color: var(--brand); 
  text-decoration: none; 
  transition: color 0.2s ease; 
}
a:hover { 
  color: var(--brand-hover); 
}


/* --- HEADER --- */
header {
  position: sticky; 
  top: 0; 
  background: rgba(10, 15, 25, 0.7);
  border-bottom: 1px solid var(--border);
  z-index: 10; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
header .wrap {
  max-width: 1280px; 
  margin: 0 auto; 
  padding: 16px 24px;
  display: flex; 
  flex-direction: column; 
  gap: 6px;
}
header h1 {
  margin: 0; 
  font-size: clamp(20px, 3vw, 26px); 
  font-weight: 700;
  display: flex; 
  align-items: center; 
  gap: 12px;
}
header .subtitle { 
  color: var(--muted); 
  font-size: 14px; 
}


/* --- LAYOUT --- */
.layout {
  display: flex; 
  flex-direction: column; 
  max-width: 1280px;
  margin: 0 auto; 
  padding: 24px; 
  gap: 24px;
}
@media (min-width: 900px) {
  .layout { 
    flex-direction: row 
  }
  .sidebar { 
    width: 280px; 
    flex-shrink: 0 
  }
}


/* --- SIDEBAR & FILTERS --- */
.sidebar {
  background: var(--panel); 
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); 
  padding: 20px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar .filter-block h3 { 
  margin: 0 0 12px 0; 
  font-size: 16px; 
  font-weight: 600; 
}
.sidebar input[type="search"] {
  width: 100%; 
  padding: 10px 14px; 
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); 
  background: #0f1116; 
  color: var(--text);
  margin-bottom: 12px; 
  font-size: 14px;
}
.sidebar input[type="search"]:focus {
  outline: 2px solid var(--brand); 
  outline-offset: 2px;
  border-color: var(--brand);
}
.controls { 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}
.controls label {
  display: flex; 
  align-items: center; 
  gap: 10px;
  padding: 8px; 
  border-radius: var(--radius-sm);
  font-size: 14px; 
  color: var(--muted); 
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.controls label:hover {
  background: rgba(255, 255, 255, 0.05); 
  color: var(--text);
}
.controls input { 
  accent-color: var(--brand); 
}
.clear-btn {
  margin-top: auto; 
  background: transparent; 
  border: 1px solid var(--border);
  color: var(--muted); 
  padding: 10px; 
  border-radius: var(--radius-sm);
  cursor: pointer; 
  text-align: center; 
  font-weight: 500;
  transition: all 0.2s ease;
}
.clear-btn:hover { 
  background: var(--card); 
  color: var(--text); 
  border-color: #4b5563; 
}


/* --- CONTENT --- */
.content { 
  flex: 1; 
  min-width: 0; 
}
.toolbar {
  display: flex; 
  flex-wrap: wrap; 
  align-items: center;
  gap: 12px; 
  margin-bottom: 16px;
}
.badge {
  font-size: 12px; 
  color: var(--muted); 
  background: var(--panel);
  padding: 6px 12px; 
  border-radius: 99px; 
  border: 1px solid var(--border);
}
.error { 
  color: var(--danger); 
}
.grid {
  display: grid; 
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: var(--card); 
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); 
  overflow: hidden;
  display: flex; 
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.2);
}
.card-content { 
  padding: 16px; 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  flex: 1; 
}
.card h3 { 
  margin: 0; 
  font-size: 16px; 
  font-weight: 600; 
  line-height: 1.4; 
  color: var(--text); 
}
.card a:hover h3 { 
  color: var(--brand); 
}
.meta { 
  font-size: 12px; 
  color: var(--muted); 
  line-height: 1.5; 
  margin-top: auto; 
}


/* --- IMAGE & PLACEHOLDER STYLES --- */
.imgwrap {
  position: relative; 
  aspect-ratio: 16/9; 
  background: #0f1116;
}
.thumb {
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  display: block;
  background: linear-gradient(135deg, #0f1116, #0b0e15);
}
.thumb.is-crest { 
  object-fit: contain; 
  padding: 12%; 
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); 
}
.thumb-default {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20%;
}
.thumb-default svg {
  width: 100%;
  height: 100%;
  opacity: 0.1;
  stroke: var(--muted);
}
.crest-chip {
  position: absolute; 
  right: 10px; 
  bottom: 10px;
  width: 44px; 
  height: 44px; 
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.6); 
  backdrop-filter: blur(4px);
  display: flex; 
  align-items: center; 
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1); 
  overflow: hidden;
}
.crest-chip img { 
  width: 80%; 
  height: 80%; 
  object-fit: contain; 
  display: block; 
}


/* --- QUICKLINKS --- */
.quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qlink {
  display: inline-block;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.qlink:hover {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
}


/* --- FOOTER --- */
.legal {
  max-width: 1280px; 
  margin: 32px auto; 
  padding: 24px;
  color: var(--muted); 
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.legal p { 
  margin: 0 0 8px 0; 
}