:root {
  --black: #0a0a0a;
  --yellow: #f2e600;
  --white: #f5f5f0;
  --grey: #8a8a80;
  --line: rgba(245, 245, 240, 0.14);
  --card-bg: #141412;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--white);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* hero */
.hero {
  position: relative;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  padding: 6vw 6vw 4vw;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero__blur {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 55% at 22% 30%, rgba(242, 230, 0, 0.55), transparent 70%),
    radial-gradient(50% 60% at 80% 70%, rgba(242, 230, 0, 0.18), transparent 70%),
    linear-gradient(135deg, #1a1a12 0%, #0a0a0a 60%);
  filter: blur(60px) saturate(1.2);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1.05); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.15); }
}
.hero__inner { position: relative; z-index: 2; }
.hero__kicker {
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0.85;
  margin-bottom: 1.2rem;
}
.hero__title {
  font-weight: 900;
  font-size: clamp(3rem, 15vw, 12rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--yellow);
  mix-blend-mode: normal;
}
.hero__sub {
  margin-top: 1rem;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
  font-weight: 500;
  color: var(--white);
}

/* filters */
.filters {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: flex-end;
  padding: 1.1rem 6vw;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.filter { display: flex; flex-direction: column; gap: 0.35rem; }
.filter label {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
}
.filter select {
  appearance: none;
  background: var(--card-bg);
  color: var(--white);
  border: 1px solid var(--line);
  padding: 0.55rem 2.2rem 0.55rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23f2e600'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
}
.filter select:focus { outline: 1px solid var(--yellow); }
.filter__reset {
  background: none;
  border: 1px solid var(--line);
  color: var(--grey);
  padding: 0.55rem 0.9rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.filter__reset:hover { color: var(--yellow); border-color: var(--yellow); }
.filter__count {
  margin-left: auto;
  align-self: center;
  color: var(--grey);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* grid */
.grid {
  columns: 4 260px;
  column-gap: 14px;
  padding: 14px 6vw 8vw;
}
.card {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  border-radius: 2px;
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(0.15) contrast(1.02);
  transition: transform 0.5s ease, filter 0.4s ease;
}
.card:hover img { transform: scale(1.04); filter: grayscale(0) contrast(1.05); }
.card__meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.2rem 0.7rem 0.6rem;
  background: linear-gradient(transparent, rgba(10, 10, 10, 0.92));
  opacity: 0;
  transition: opacity 0.25s;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.card:hover .card__meta { opacity: 1; }
.card__vid {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  letter-spacing: 0.08em;
  border-radius: 2px;
}
.chip {
  font-size: 0.66rem;
  padding: 0.16rem 0.45rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.chip--person { background: var(--yellow); color: var(--black); font-weight: 600; }
.chip--place { background: rgba(245, 245, 240, 0.16); color: var(--white); }
.chip--event { border: 1px solid var(--line); color: var(--grey); }
.chip--geo { background: none; color: var(--yellow); border: 1px solid var(--yellow); }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 6, 6, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vw;
}
.lightbox[hidden] { display: none; }
.lightbox__figure {
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.lb-stage img,
.lb-video {
  display: block;
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
}
.lb-video { background: #000; }
.lb-video[hidden], .lb-stage img[hidden] { display: none; }

/* face boxes */
.lb-faces {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.lb-faces.is-on { pointer-events: none; }
.lb-faces.is-edit { pointer-events: auto; cursor: crosshair; touch-action: none; }
.lb-face {
  position: absolute;
  border: 2px solid var(--yellow);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.6);
  pointer-events: auto;
}
.lb-faces:not(.is-on):not(.is-edit) .lb-face { display: none; }
/* blueprint-style leader-line callouts */
.lb-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.lb-line { fill: none; stroke: var(--yellow); stroke-width: 1; opacity: 0.9; }
.lb-line-dot { fill: var(--yellow); }
.lb-callout {
  position: absolute;
  transform: translateY(-50%);
  max-width: 46%;
  background: rgba(10, 10, 10, 0.86);
  color: var(--yellow);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.08rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--yellow);
  border-radius: 2px;
  font-family: 'Inter', sans-serif;
  pointer-events: none;
  z-index: 4;
}
.lb-callout--l { left: 0; text-align: left; }
.lb-callout--r { right: 0; text-align: right; }
.lb-face--hl {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--yellow), 0 0 20px rgba(242, 230, 0, 0.6);
}
.lb-faces.is-edit .lb-face { cursor: move; touch-action: none; }
.lb-face__h {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--yellow);
  border: 1px solid var(--black);
  border-radius: 50%;
  display: none;
  touch-action: none;
}
.lb-faces.is-edit .lb-face__h { display: block; }
.lb-face__h--nw { left: -8px; top: -8px; cursor: nwse-resize; }
.lb-face__h--ne { right: -8px; top: -8px; cursor: nesw-resize; }
.lb-face__h--sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.lb-face__h--se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.lb-face--draft { border-style: dashed; }
.lb-face--sel { border-color: #fff; box-shadow: 0 0 0 2px var(--yellow); z-index: 4; }

/* single docked name editor under the toolbar (no per-box inputs) */
.lb-faceedit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  margin: 0.6rem auto 0;
  max-width: 420px;
}
.lb-faceedit[hidden] { display: none; }
.lb-faceedit input {
  flex: 1;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--yellow);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
}

/* lightbox toolbar */
.lb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
}
.lb-tool {
  background: none;
  border: 1px solid var(--line);
  color: var(--grey);
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.lb-tool:hover { color: var(--yellow); border-color: var(--yellow); }
.lb-tool[aria-pressed="true"] { background: var(--yellow); color: var(--black); border-color: var(--yellow); }
.lb-hint { color: var(--grey); font-size: 0.72rem; }
.lightbox__tags .chip { cursor: pointer; }
.lightbox__tags .chip--active { outline: 2px solid #fff; }
.chip--rm { cursor: pointer; }
.tag-edit {
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--yellow);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.tag-edit--event { border-color: var(--line); }
.tag-edit--place { min-width: 120px; }

/* custom suggestion dropdown (native datalist doesn't open on mobile) */
.ac-list {
  flex-basis: 100%;
  width: 100%;
  max-width: 420px;
  margin: 0.3rem auto 0;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--yellow);
  border-radius: 4px;
}
.ac-list[hidden] { display: none; }
.ac-item {
  padding: 0.55rem 0.7rem;
  color: var(--white);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item:active { background: var(--yellow); color: var(--black); }
.lightbox__cap {
  margin-top: 1rem;
  max-width: 720px;
  text-align: center;
}
.lightbox__cap p { color: var(--white); font-size: 0.95rem; line-height: 1.5; }
.lightbox__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.8rem;
}
.lightbox__geo { margin-top: 0.6rem; color: var(--yellow); font-size: 0.85rem; }
.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  line-height: 1;
  z-index: 10;
}
.lightbox__close { top: 2vw; right: 2.5vw; font-size: 2.6rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); font-size: 3.5rem; padding: 0 1.5vw; }
.lightbox__prev { left: 1vw; }
.lightbox__next { right: 1vw; }
.lightbox__close:hover,
.lightbox__nav:hover { color: var(--yellow); }

/* footer */
.foot {
  padding: 3rem 6vw;
  border-top: 1px solid var(--line);
  color: var(--grey);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .grid { columns: 2 140px; column-gap: 8px; padding: 8px 4vw 12vw; }
  .card { margin-bottom: 8px; }
  .filters { padding: 0.9rem 4vw; gap: 0.8rem; }
  .filter select { padding: 0.5rem 2rem 0.5rem 0.6rem; font-size: 0.85rem; }
}

.fab-add {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: var(--black);
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(242, 230, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.fab-add:hover { transform: scale(1.06); }
.fab-add:active { transform: scale(0.94); }
.fab-add[aria-busy="true"] {
  color: transparent;
  pointer-events: none;
}
.fab-add[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(10, 10, 10, 0.35);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: fab-spin 0.7s linear infinite;
}
@keyframes fab-spin { to { transform: rotate(360deg); } }

.fab-toast {
  position: fixed;
  right: 20px;
  bottom: 92px;
  max-width: 70vw;
  padding: 0.7rem 1rem;
  background: var(--card-bg);
  color: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--yellow);
  border-radius: 6px;
  font-size: 0.85rem;
  z-index: 51;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
