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

:root {
  --ink: #14110F;
  --paper: #F5F1E8;
  --pink: #FF3B7F;
  --blue: #1E4FFF;
  --yellow: #FFC93C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
}

a { color: inherit; }

.app { max-width: 1100px; margin: 0 auto; padding: 20px 20px 60px; }

/* --- Nav bar --- */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.nav-brand {
  font-family: 'Archivo Black', sans-serif;
  font-size: 22px;
  text-decoration: none;
  color: var(--ink);
}
.nav-brand span { color: var(--pink); }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.nav-link {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid transparent;
}
.nav-link:hover { border-color: var(--yellow); }
.nav-link-cta {
  background: var(--ink);
  color: var(--paper) !important;
  padding: 8px 14px;
  border-radius: 6px;
}
.nav-link-cta:hover { background: var(--pink); }
.nav-user {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-avatar { width: 22px; height: 22px; border-radius: 50%; }

/* --- Slate header --- */
.slate {
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.slate::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14px;
  background: repeating-linear-gradient(110deg, var(--paper) 0 26px, var(--ink) 26px 52px);
}
.slate-top { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; }
.brand { font-family: 'Archivo Black', sans-serif; font-size: 34px; letter-spacing: -0.5px; color: var(--paper); }
.brand span { color: var(--yellow); }
.tagline { font-family: 'Space Mono', monospace; font-size: 12px; color: #cfcac0; margin-top: 2px; }

.search-row { display: flex; gap: 10px; margin-top: 18px; position: relative; }
.search-wrap { flex: 1; position: relative; }
.search-row input {
  width: 100%; padding: 13px 16px; border-radius: 6px; border: none;
  font-family: 'Space Mono', monospace; font-size: 15px; background: var(--paper); color: var(--ink);
}
.search-row input:focus { outline: 3px solid var(--yellow); }
.search-row button {
  font-family: 'Archivo Black', sans-serif; background: var(--pink); color: var(--paper);
  border: none; border-radius: 6px; padding: 0 22px; font-size: 14px; cursor: pointer; letter-spacing: 0.5px;
}
.search-row button:hover { background: var(--blue); }
.search-row button:focus-visible, .chip:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.suggestions {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--paper); border-radius: 6px; overflow: hidden; z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.suggestions.open { display: block; }
.suggestions button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid #e3ddcf; padding: 10px 14px; font-family: 'Space Mono', monospace;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.suggestions button:last-child { border-bottom: none; }
.suggestions button:hover { background: var(--yellow); }

.chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  font-family: 'Space Mono', monospace; font-size: 12px; background: transparent;
  border: 1px solid #55504a; color: #cfcac0; border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.chip:hover, .chip.active { border-color: var(--yellow); color: var(--yellow); }

.cat-rail { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 6px; }
.cat-card {
  flex: 0 0 auto; width: 110px; height: 68px; border-radius: 8px; position: relative;
  overflow: hidden; cursor: pointer; border: 2px solid transparent; background: #26221d;
}
.cat-card.active { border-color: var(--pink); }
.cat-card img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.75; }
.cat-card span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; font-family: 'Archivo Black', sans-serif; font-size: 11px; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6); padding: 4px; text-transform: uppercase;
}

.status { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--ink); margin: 4px 4px 14px; min-height: 16px; }
.status.error { color: var(--pink); }

.filmstrip { position: relative; background: var(--ink); border-radius: 10px; padding: 18px; }
.sprockets-top, .sprockets-bottom { display: flex; justify-content: space-around; padding: 0 6px; }
.sprockets-top { margin-bottom: 12px; }
.sprockets-bottom { margin-top: 12px; }
.hole { width: 10px; height: 10px; background: var(--paper); border-radius: 2px; }

.grid { column-count: 2; column-gap: 10px; }
@media (min-width: 620px) { .grid { column-count: 3; } }
@media (min-width: 860px) { .grid { column-count: 4; } }
@media (min-width: 1060px) { .grid { column-count: 5; } }

.card {
  position: relative; border-radius: 6px; overflow: hidden; background: #26221d;
  cursor: pointer; border: 2px solid transparent; margin-bottom: 10px; break-inside: avoid;
  display: inline-block; width: 100%; text-decoration: none;
}
.card:hover, .card:focus-visible { border-color: var(--yellow); }
.card img { width: 100%; height: auto; display: block; }
.card .label {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  color: var(--paper); font-family: 'Space Mono', monospace; font-size: 10.5px;
  padding: 16px 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.empty { text-align: center; color: #cfcac0; font-family: 'Space Mono', monospace; font-size: 13px; padding: 50px 10px; }
.sentinel { height: 1px; }
.loading-more, .end-msg { text-align: center; font-family: 'Space Mono', monospace; font-size: 12px; padding: 14px 0 2px; color: #cfcac0; }
.end-msg { color: #6b665f; font-size: 11px; }

/* --- Modal --- */
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,17,15,0.9);
  align-items: flex-start; justify-content: center; padding: 20px; z-index: 50; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal { background: var(--paper); border-radius: 10px; max-width: 560px; width: 100%; overflow: hidden; position: relative; margin: 20px 0 40px; }
.modal img.hero { width: 100%; display: block; background: #000; }
.modal-body { padding: 16px 18px 18px; }
.modal-title { font-family: 'Archivo Black', sans-serif; font-size: 16px; margin: 0 0 4px; }
.modal-sub { font-family: 'Space Mono', monospace; font-size: 11px; color: #55504a; margin: 0 0 14px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions a, .modal-actions button {
  font-family: 'Space Mono', monospace; font-size: 12px; text-decoration: none; border: 2px solid var(--ink);
  color: var(--ink); background: transparent; border-radius: 6px; padding: 9px 14px; cursor: pointer;
}
.modal-actions a:hover, .modal-actions button:hover { background: var(--ink); color: var(--paper); }
.close-btn {
  position: absolute; top: 10px; right: 10px; background: var(--paper); border: none;
  border-radius: 50%; width: 30px; height: 30px; font-size: 16px; cursor: pointer; z-index: 5;
}

.related-heading {
  font-family: 'Space Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: #55504a; margin: 18px 0 8px;
}
.related-grid { column-count: 3; column-gap: 8px; }
.related-grid .card { margin-bottom: 8px; }

/* --- Detail page --- */
.detail-page {
  background: var(--ink); border-radius: 10px; overflow: hidden;
  display: grid; grid-template-columns: 1fr; max-width: 700px; margin: 0 auto;
}
.detail-media img.hero, .detail-media video.hero { width: 100%; display: block; background: #000; }
.detail-body { background: var(--paper); padding: 18px 20px 22px; }

/* --- Upload page --- */
.upload-form {
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 24px; max-width: 520px; margin: 0 auto;
}
.upload-form h1 { font-family: 'Archivo Black', sans-serif; font-size: 22px; margin: 0 0 6px; }
.upload-form p.hint { font-family: 'Space Mono', monospace; font-size: 12px; color: #cfcac0; margin: 0 0 18px; }
.upload-form label { display: block; font-family: 'Space Mono', monospace; font-size: 12px; margin: 14px 0 6px; }
.upload-form input[type=text], .upload-form input[type=file] {
  width: 100%; padding: 11px 14px; border-radius: 6px; border: none;
  font-family: 'Space Mono', monospace; font-size: 14px; background: var(--paper); color: var(--ink);
}
.upload-form button[type=submit] {
  margin-top: 18px; font-family: 'Archivo Black', sans-serif; background: var(--pink); color: var(--paper);
  border: none; border-radius: 6px; padding: 12px 22px; font-size: 14px; cursor: pointer;
}
.upload-form button[type=submit]:hover { background: var(--blue); }
.form-msg { font-family: 'Space Mono', monospace; font-size: 12px; margin-top: 10px; }
.form-msg.error { color: var(--pink); }
.form-msg.success { color: #6ee7a8; }

.footnote { margin-top: 22px; font-family: 'Space Mono', monospace; font-size: 11px; color: #6b665f; line-height: 1.6; text-align: center; }
.footnote a { color: var(--blue); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
