/* Sauron mökkikamera — ember theme */

:root {
  --bg: #0c0a08;
  --surface: #171310;
  --surface2: #100d0a;
  --border: #2b241d;
  --text: #ece4d8;
  --muted: #8f8577;
  --ember1: #ff8c1a;
  --ember2: #ffb52e;
  --ember-grad: linear-gradient(100deg, var(--ember1), var(--ember2));
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

body.noscroll { overflow: hidden; }

.wordmark {
  font-weight: 650;
  letter-spacing: .42em;
  text-indent: .42em;
  background: var(--ember-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline { color: var(--muted); font-size: 13px; letter-spacing: .05em; }

.eye { width: 46px; height: 23px; display: block; }
.eye-lg { width: 92px; height: 46px; margin: 0 auto 18px; }
.eye-dim { width: 76px; height: 38px; margin: 0 auto 14px; opacity: .8; }

button, .ghost { font: inherit; }

.ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.ghost:hover { color: var(--text); border-color: #4a4136; }
.ghost.on { color: var(--ember2); border-color: rgba(255,140,26,.55); }

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(255,110,20,.13), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% -10%, rgba(255,181,46,.05), transparent 70%);
}

.login-card {
  width: min(92vw, 380px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 36px 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  text-align: center;
  animation: rise .45s ease-out;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.login-card h1 { font-size: 26px; }
.login-card .tagline { margin: 8px 0 30px; }

.login-form { display: grid; gap: 12px; text-align: left; }

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 13px 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus {
  border-color: var(--ember1);
  box-shadow: 0 0 0 3px rgba(255,140,26,.18);
}
.login-form input::placeholder { color: #5d554a; }

.login-form input[type="submit"] {
  margin-top: 8px;
  padding: 13px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 650;
  color: #201200;
  background: var(--ember-grad);
  cursor: pointer;
  transition: filter .15s;
}
.login-form input[type="submit"]:hover { filter: brightness(1.08); }

.form-error { color: #ff7a66; font-size: 14px; margin-top: 16px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 3vw, 28px);
  background: rgba(12,10,8,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 13px; }
.wordmark-sm { font-size: 17px; }

/* ---------- day rail ---------- */

.dayrail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px clamp(14px, 3vw, 28px) 4px;
  scrollbar-width: none;
}
.dayrail::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: #4a4136; }

.labelrail { padding-top: 4px; }
.labelrail .chip { font-size: 13px; padding: 6px 12px; }
.chip.on {
  background: var(--ember-grad);
  border-color: transparent;
  color: #201200;
  font-weight: 650;
}

.badge {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.25);
}
.chip:not(.on) .badge { background: var(--surface2); color: var(--muted); }

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px clamp(14px, 3vw, 28px);
}

.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg a {
  padding: 7px 16px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.seg a:hover { color: var(--text); }
.seg a.on { background: var(--ember-grad); color: #201200; font-weight: 650; }

.count { color: var(--muted); font-size: 14px; }

/* ---------- grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 4px clamp(14px, 3vw, 28px) 40px;
}

.card {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  animation: fadein .3s ease-out both;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.card:hover {
  border-color: rgba(255,140,26,.55);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 24px rgba(255,140,26,.08);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}
.card:hover img { transform: scale(1.05); }
.card.noimg img { visibility: hidden; }

.card .time {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 12.5px;
  color: #fff;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.card .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
}
.card .play svg {
  width: 42px;
  height: 42px;
  padding: 9px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.25);
  transition: background .15s, transform .15s;
}
.card:hover .play svg { background: rgba(255,140,26,.75); transform: scale(1.08); }

.card .labels {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.label {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,140,26,.85);
  color: #201200;
  font-weight: 650;
}

/* ---------- timelapse player ---------- */

.topnav { display: flex; gap: 8px; align-items: center; }

.player {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px clamp(14px, 3vw, 28px) 40px;
}

.player-stage {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
}
.player-stage img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.det-boxes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.det-box {
  position: absolute;
  min-width: 14px;
  min-height: 14px;
  border: 2px solid var(--ember1);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.35);
}
.det-box span {
  position: absolute;
  bottom: 100%;
  left: -2px;
  margin-bottom: 3px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ember-grad);
  color: #201200;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.player-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 14px;
}

.live-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ember-grad);
  color: #201200;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .04em;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.play-btn {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  font-size: 17px;
  color: #201200;
  background: var(--ember-grad);
  cursor: pointer;
  transition: filter .15s;
}
.play-btn:hover { filter: brightness(1.08); }

.player-controls input[type="range"] {
  flex: 1;
  accent-color: var(--ember1);
  min-width: 60px;
}

.player-controls select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
}

.player .count { margin-top: 10px; text-align: center; }

.hud-tags {
  color: var(--ember2);
  font-weight: 650;
  font-size: 13px;
}
.hud-tags[hidden] { display: none; }

.sightings {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}
.sightings h2 { font-size: 14px; font-weight: 650; margin-bottom: 10px; }
.sighting {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 8px 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s;
}
.sighting:hover { border-color: rgba(255,140,26,.55); }

/* ---------- stats ---------- */

.stats {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 28px) 48px;
  display: grid;
  gap: 16px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.tile-value {
  font-size: 30px;
  font-weight: 650;
  background: var(--ember-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tile-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.chart-card h2 { font-size: 15px; font-weight: 650; margin-bottom: 16px; }
.chart-note { color: var(--muted); font-size: 12.5px; margin-top: 12px; }

/* horizontal label bars */
.hbars { display: grid; gap: 8px; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr 40px;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.hbar-label { font-size: 14px; text-align: right; }
.hbar-track { background: var(--surface2); border-radius: 6px; height: 18px; overflow: hidden; }
.hbar-fill {
  display: block;
  height: 100%;
  background: var(--ember1);
  border-radius: 0 4px 4px 0;
  min-width: 3px;
  transition: filter .15s;
}
.hbar-row:hover .hbar-fill { filter: brightness(1.15); }
.hbar-value { font-size: 13px; color: var(--muted); }

/* vertical bars */
.vbars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 150px;
  padding-top: 18px;
}
.vbar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  min-width: 0;
}
.vbar {
  width: 100%;
  background: var(--ember1);
  border-radius: 4px 4px 0 0;
  min-height: 1px;
  transition: filter .15s;
}
.vbar-col:hover .vbar { filter: brightness(1.2); }
.vbar-tick {
  position: absolute;
  top: 100%;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.vbar-peak {
  font-size: 11px;
  color: var(--text);
  margin-bottom: 3px;
}
.vbars { margin-bottom: 22px; }

.vbars-temp { height: 70px; margin-top: 6px; }
.vbar-muted { background: #a8792e; }
.chart-card h2 .dim { font-weight: 400; margin-left: 8px; }

.table-view summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.table-view table { margin-top: 12px; border-collapse: collapse; width: 100%; }
.table-view th, .table-view td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table-view th { color: var(--muted); font-weight: 650; }

/* ---------- empty state ---------- */

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
  font-size: 15px;
}

/* ---------- lightbox ---------- */

.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5,4,3,.93);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.lb-stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px;
}

.lb-media {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,.6);
  outline: none;
}

/* Video fills the stage; object-fit letterboxes the picture, so the native
   control bar lands on the empty band below the image, not on top of it. */
video.lb-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: none;
}

.lb-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px clamp(14px, 3vw, 28px) 18px;
}
.lb-meta { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.dim { color: var(--muted); font-size: 12.5px; }

.lb-close, .lb-nav {
  position: absolute;
  z-index: 51;
  background: rgba(23,19,16,.7);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.lb-close:hover, .lb-nav:hover { background: #2b241d; border-color: #4a4136; }

.lb-close {
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 30px;
  line-height: 1;
  padding-bottom: 4px;
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .lb-nav { top: auto; bottom: 84px; transform: none; }
  .toolbar { justify-content: center; }
  .count { width: 100%; text-align: center; }
}
