@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #0b0b0d;
  --surface: #141316;
  --surface-raised: #1b1a1e;
  --hairline: #2a292c;
  --bone: #e9e4da;
  --bone-dim: #a39d92;
  --muted: #6f6a63;
  --wine: #7a1f2b;
  --wine-bright: #a8283a;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(122, 31, 43, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 500px at 15% 100%, rgba(122, 31, 43, 0.10), transparent 65%),
    radial-gradient(ellipse 700px 500px at 90% 80%, rgba(122, 31, 43, 0.08), transparent 65%);
  background-repeat: no-repeat;
  min-height: 100vh;
  position: relative;
}

#embers-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.gate-logo {
  height: 46px;
  width: auto;
  margin: 0 auto 22px;
  display: block;
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 20px 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.site-footer .divider {
  color: var(--wine);
  margin: 0 8px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

a, button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--wine-bright);
  outline-offset: 2px;
}

/* ---------- Login gate ---------- */

.gate-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.gate {
  flex: 1;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.gate-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 40px 28px 32px;
}

.gate-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--wine);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--bone-dim);
  margin-bottom: 20px;
}

.gate-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 10px;
}

.gate-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--bone-dim);
  margin: 0 0 28px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-form input {
  background: var(--bg);
  border: 1px solid var(--hairline);
  color: var(--bone);
  padding: 13px 14px;
  border-radius: 3px;
  font-size: 15px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-align: center;
}

.gate-form input::placeholder { color: var(--muted); }

.gate-form button {
  background: var(--wine);
  color: var(--bone);
  border: none;
  padding: 13px 14px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease;
}

.gate-form button:hover:not(:disabled) { background: var(--wine-bright); }
.gate-form button:disabled { opacity: 0.6; cursor: default; }

.gate-error {
  color: var(--wine-bright);
  font-size: 13px;
  margin-top: 14px;
}

.gate-footer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 20px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
  padding: 16px 20px 14px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone-dim);
  border: 1px solid var(--wine);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  margin: 0;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
}

.ghost-btn {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--bone-dim);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-btn:hover { border-color: var(--wine); color: var(--bone); }

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-group::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--bone-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--wine); }

.chip.is-active {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--bone);
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--bone);
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 13px;
  width: 100%;
}
.search-input::placeholder { color: var(--muted); }

/* ---------- Grid ---------- */

main { padding: 16px 20px 60px; max-width: 1400px; margin: 0 auto; position: relative; z-index: 1; }

.count-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin: 4px 2px 14px;
  letter-spacing: 0.03em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}
@media (min-width: 1300px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

.card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--surface);
}

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

.card-cat {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--bone-dim);
  background: rgba(11, 11, 13, 0.72);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3px 6px;
  border-radius: 3px;
}

.card-type {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone);
  background: rgba(122, 31, 43, 0.85);
  padding: 3px 6px;
  border-radius: 3px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 60px 20px;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 7, 0.96);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-body {
  max-width: 900px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-media {
  width: 100%;
  max-height: 74vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media img, .lightbox-media video {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 3px;
}

.lightbox-meta {
  width: 100%;
  padding: 14px 4px 0;
  text-align: left;
}

.lightbox-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--wine-bright);
  letter-spacing: 0.04em;
}

.lightbox-meta p {
  font-size: 14px;
  color: var(--bone);
  margin: 6px 0;
  line-height: 1.5;
}

.lightbox-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.lightbox-source {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--wine-bright);
  text-decoration: none;
  border-bottom: 1px solid var(--wine);
  padding-bottom: 2px;
}

.lightbox-source:hover {
  color: var(--bone);
  border-color: var(--bone-dim);
}

.lightbox-close, .lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--bone-dim);
  font-size: 28px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
}

.lightbox-close:hover, .lightbox-nav:hover { color: var(--bone); }

.lightbox-close { top: 10px; right: 10px; }
.lightbox-prev { left: 4px; top: 50%; transform: translateY(-50%); font-size: 36px; }
.lightbox-next { right: 4px; top: 50%; transform: translateY(-50%); font-size: 36px; }

@media (max-width: 640px) {
  .lightbox-prev, .lightbox-nav.lightbox-prev { left: 0; }
  .lightbox-next, .lightbox-nav.lightbox-next { right: 0; }
}
