:root {
  --bg: #05060a;
  --bg-elevated: #0c0e14;
  --bg-card: #11141c;
  --bg-card-hover: #161b26;
  --border: #1e2533;
  --text: #e8edf5;
  --text-muted: #8b95a8;
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --cta: #f97316;
  --cta-hover: #fb923c;
  --ring: #60a5fa;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

body {
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(900px 400px at 90% 0%, rgba(249, 115, 22, 0.1), transparent 50%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 1000;
  padding: 8px 12px;
  background: var(--cta);
  color: #111;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.site-header,
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 6, 10, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
}

.brand-mark {
  width: 28px;
  height: 28px;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-host {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.header-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}

.header-link:hover {
  color: var(--text);
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-7) 0 var(--space-6);
}

.hero h1 {
  margin: 0 0 var(--space-3);
  font-size: clamp(2.25rem, 6vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 42rem;
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-6);
}

.search {
  flex: 1 1 240px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
}

.search::placeholder {
  color: var(--text-muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.filter:hover,
.filter[aria-pressed="true"] {
  color: var(--text);
  border-color: #334155;
  background: var(--bg-card);
}

.filter[aria-pressed="true"] {
  border-color: var(--primary);
  color: #dbeafe;
}

.count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: #334155;
}

.card-kicker {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.card p {
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
  flex: 1;
}

.card-cta {
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--cta);
  color: #111;
  font-weight: 600;
  transition: background 180ms ease, transform 180ms ease;
}

.card:hover .card-cta,
.card-cta:hover {
  background: var(--cta-hover);
}

.empty {
  grid-column: 1 / -1;
  padding: var(--space-6);
  color: var(--text-muted);
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-6) 0 var(--space-7);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.viewer {
  display: none;
  flex-direction: column;
  height: 100dvh;
}

.viewer.is-open,
.catalog.is-hidden {
  display: none;
}

body.is-viewer .catalog {
  display: none;
}

body.is-viewer .viewer {
  display: flex;
}

.viewer-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.viewer-meta strong {
  letter-spacing: -0.03em;
}

.viewer-meta span {
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.ghost,
.primary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: background 180ms ease, border-color 180ms ease;
}

.ghost:hover {
  background: var(--bg-card-hover);
}

.primary {
  border-color: transparent;
  background: var(--cta);
  color: #111;
  font-weight: 600;
}

.primary:hover {
  background: var(--cta-hover);
}

.frame-wrap {
  flex: 1;
  min-height: 0;
  background: #000;
}

.frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

@media (max-width: 720px) {
  .site-header,
  .viewer-bar {
    flex-wrap: wrap;
  }

  .viewer-actions {
    width: 100%;
  }

  .ghost,
  .primary {
    flex: 1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .card:hover {
    transform: none;
  }
}
