/* OPEN UFO ARCHIVE — UFO / alien encounters open archive
   Cosmic / atmospheric aesthetic. Deep, quiet, serious. */

:root {
  --bg-0: #07080c;        /* true black void */
  --bg-1: #0c0e15;        /* panel */
  --bg-2: #11141d;        /* elevated */
  --bg-3: #171b26;        /* hover */
  --line: #1d2230;        /* hairline */
  --line-2: #272d3d;
  --ink-0: #e8e6df;       /* primary warm white */
  --ink-1: #a8a89f;       /* secondary */
  --ink-2: #6b6c68;       /* muted */
  --ink-3: #44464a;       /* disabled */

  /* accents — unified chroma + lightness, only hue varies */
  --amber: oklch(0.78 0.11 75);    /* signal / warm */
  --amber-dim: oklch(0.55 0.09 75);
  --cyan: oklch(0.78 0.08 210);    /* cold / data */
  --cyan-dim: oklch(0.55 0.07 210);
  --rose: oklch(0.70 0.11 25);     /* flagged / admin alert */
  --rose-dim: oklch(0.50 0.09 25);
  --green: oklch(0.72 0.08 150);   /* verified / approved */

  --serif: 'Newsreader', 'Source Serif 4', Georgia, serif;
  --sans: 'Inter Tight', 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  --fs-display: 64px;
  --fs-h1: 42px;
  --fs-h2: 28px;
  --fs-h3: 20px;
  --fs-body: 15px;
  --fs-small: 13px;
  --fs-micro: 11px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

#root {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}
.screen-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.screen-scroll::-webkit-scrollbar-track { background: transparent; }
.screen-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.screen-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* Starfield — subtle, procedural-looking via radial gradients */
.starfield {
  position: absolute; inset: 0;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,0.7), transparent 50%),
    radial-gradient(1px 1px at 28% 42%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(0.8px 0.8px at 8% 72%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1.2px 1.2px at 44% 88%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(0.8px 0.8px at 62% 12%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 78% 64%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1.4px 1.4px at 92% 32%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(0.8px 0.8px at 52% 52%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(1px 1px at 36% 78%, rgba(255,255,255,0.45), transparent 50%),
    radial-gradient(0.6px 0.6px at 82% 82%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 4% 38%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(0.8px 0.8px at 68% 28%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(ellipse at 75% 25%, rgba(120, 140, 180, 0.08), transparent 60%),
    radial-gradient(ellipse at 15% 75%, rgba(180, 120, 80, 0.05), transparent 55%);
  pointer-events: none;
}

.grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.6;
}

/* Header / top nav */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(7,8,12,0.75);
  backdrop-filter: blur(12px);
  position: relative; z-index: 10;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif); font-size: 22px; font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.brand-mark {
  width: 26px; height: 26px;
  border: 1px solid var(--ink-1);
  border-radius: 50%;
  position: relative;
  display: inline-block;
}
.brand-mark::before {
  content: '';
  position: absolute; inset: 4px;
  border: 1px solid var(--ink-0);
  border-radius: 50%;
  border-top-color: transparent;
  border-left-color: transparent;
}
.brand-mark::after {
  content: ''; position: absolute;
  width: 3px; height: 3px;
  background: var(--amber);
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 6px var(--amber);
}

.nav { display: flex; gap: 4px; align-items: center; }
.nav-link {
  padding: 8px 14px;
  color: var(--ink-1);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  font-weight: 500;
}
.nav-link:hover { color: var(--ink-0); background: var(--bg-2); }
.nav-link.active { color: var(--amber); }

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

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-0);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-1); background: var(--bg-2); }
.btn-primary {
  background: var(--amber);
  color: #1a1408;
  border-color: var(--amber);
  font-weight: 600;
}
.btn-primary:hover { background: var(--ink-0); border-color: var(--ink-0); }
.btn-ghost { border-color: transparent; color: var(--ink-1); padding: 8px 12px; }
.btn-ghost:hover { color: var(--ink-0); background: var(--bg-2); }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-danger { color: var(--rose); border-color: var(--rose-dim); }
.btn-danger:hover { background: rgba(220,80,80,0.08); }

/* Inputs */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  color: var(--ink-0);
  font-family: var(--sans);
  font-size: 14px;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--amber-dim); }
/* Grows with its text (see autoGrowTextareas in components.jsx): no inner scroll bar. */
.textarea { resize: none; overflow-y: hidden; min-height: 120px; line-height: 1.6; }

/* Labels */
.label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}

/* Chips / tags */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  color: var(--ink-1);
  border-radius: 2px;
  background: var(--bg-1);
}
.chip-amber { color: var(--amber); border-color: var(--amber-dim); background: rgba(220,170,80,0.05); }
.chip-cyan { color: var(--cyan); border-color: var(--cyan-dim); background: rgba(80,170,220,0.05); }
.chip-green { color: var(--green); border-color: rgba(100,180,130,0.3); background: rgba(100,180,130,0.05); }
.chip-rose { color: var(--rose); border-color: var(--rose-dim); background: rgba(220,80,80,0.05); }

/* Serif display */
.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }

.divider {
  height: 1px; background: var(--line); border: none;
  margin: 0;
}

/* Placeholder imagery — subtly striped duotone */
.img-placeholder {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(120,140,180,0.08) 0px,
      rgba(120,140,180,0.08) 1px,
      transparent 1px,
      transparent 8px
    ),
    linear-gradient(135deg, #1a1f2e 0%, #0f1220 60%, #14101a 100%);
  position: relative;
  overflow: hidden;
}
.img-placeholder::before {
  content: attr(data-caption);
  position: absolute;
  bottom: 10px; left: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  text-transform: uppercase;
  opacity: 0.7;
}
.img-placeholder::after {
  /* subtle light blob to feel atmospheric */
  content: '';
  position: absolute;
  width: 60%; height: 60%;
  top: 10%; left: 30%;
  background: radial-gradient(ellipse, rgba(255,220,180,0.12) 0%, transparent 70%);
  filter: blur(10px);
}

/* A real picture replaces the placeholder's stripes, glow and caption */
.img-placeholder.has-img { background: var(--bg-2); }
.img-placeholder.has-img::before, .img-placeholder.has-img::after { display: none; }

/* Card / entry */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  transition: border-color 0.15s;
  border-radius: 2px;
}
.card:hover { border-color: #39415a; }

/* Coordinate readouts */
.coord {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.05em;
}

/* Signal bar — credibility indicator */
.signal {
  display: inline-flex; gap: 2px; align-items: flex-end; height: 10px;
}
.signal span {
  width: 3px; background: var(--ink-3); border-radius: 0.5px;
}
.signal span.on { background: var(--amber); }
.signal span:nth-child(1) { height: 3px; }
.signal span:nth-child(2) { height: 5px; }
.signal span:nth-child(3) { height: 7px; }
.signal span:nth-child(4) { height: 9px; }
.signal span:nth-child(5) { height: 11px; }

/* Blink */
@keyframes blink { 50% { opacity: 0.3; } }
.blink { animation: blink 1.8s infinite; }

/* Horizontal scroll-y fix */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Tooltip dot */
.dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}
.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot-rose { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ── Design refresh additions ──────────────────────────────── */

/* Clickable list rows (browse results, map incident index) */
.arch-row { cursor: pointer; transition: background 0.12s; }
.arch-row:hover { background: var(--bg-2); }

/* Entry-ID badge overlaid on evidence frames */
.id-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  color: var(--ink-1); background: rgba(7,8,12,0.82);
  border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 2px;
  pointer-events: none;
}

/* Per-category tint laid over placeholder frames */
.wash-overlay { position: absolute; inset: 0; pointer-events: none; }

/* Dark Leaflet tooltip so map hover labels match the theme */
.leaflet-tooltip.arch-tip {
  background: #0c0e15; border: 1px solid #272d3d; color: #e8e6df;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .03em;
  box-shadow: 0 4px 16px rgba(0,0,0,.5); border-radius: 2px; padding: 4px 9px;
}
.leaflet-tooltip.arch-tip::before { display: none; } /* remove the callout arrow */

.leaflet-container { background: #0c0e15; }

/* ── Phones ────────────────────────────────────────────────────
   Layouts are inline styles written for desktop. Below 760px these
   classes override them (hence !important; inline styles win otherwise):
     m-pad      side padding 60px → 16px      m-pad-in  inner card padding
     m-flush    no padding
     m-stack    any grid → one column         m-gap     24px gap for stacked grids
     m-cols-2   any grid → two columns        m-wrap    let a flex row wrap
     m-col      flex row → column             m-table   wide table: scrolls sideways
     m-page     two-pane full-height screen → one scrolling column
     m-hide     hidden on phones              m-only    shown on phones only      */
.m-only { display: none !important; }
.topbar-menu { display: none; }

@media (max-width: 760px) {
  .m-only { display: inline-flex !important; }
  .m-hide { display: none !important; }
  .m-pad { padding-left: 16px !important; padding-right: 16px !important; }
  .m-pad-in { padding: 24px 20px !important; }
  .m-flush { padding: 0 !important; }
  .m-stack { grid-template-columns: 1fr !important; }
  .m-gap { gap: 24px !important; }
  .m-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
  .m-wrap { flex-wrap: wrap !important; row-gap: 10px !important; }
  .m-col { flex-direction: column !important; align-items: stretch !important; gap: 16px !important; }
  .m-table { overflow-x: auto; }
  .m-table > * { min-width: 680px; }
  .m-page { display: block !important; overflow-y: auto !important; }
  .m-margin { margin-left: 16px !important; margin-right: 16px !important; }
  .m-scroll-x { overflow-x: auto; flex-wrap: nowrap !important; }
  .m-scroll-x > * { flex-shrink: 0; }
  .m-short { min-height: 220px !important; }
  .evidence-pic { height: 150px !important; }
  .entry-hero-img { width: 100% !important; height: auto !important; max-width: 100% !important; max-height: 70vh; }

  h1.display { font-size: clamp(32px, 9vw, 44px) !important; }
  h2.display { font-size: 26px !important; }

  /* Top bar: brand + menu button; the links open in a panel below */
  .topbar { padding: 12px 16px; }
  .brand { font-size: 17px; gap: 10px; }
  .topbar > .nav, .topbar > .nav-right { display: none; }
  .topbar-menu {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-1); border-bottom: 1px solid var(--line-2);
    padding: 8px 16px 16px; z-index: 20;
  }
  .topbar-menu .nav-link { padding: 14px 4px; font-size: 14px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .topbar-menu .btn { margin-top: 12px; justify-content: center; }

  /* Browse: filters fold away behind a button */
  .m-collapse:not(.open) { display: none !important; }
  .m-collapse { border-right: none !important; border-bottom: 1px solid var(--line); }

  /* Map: map on top, incident index below */
  .m-map-pane { height: 58vh; }
  .m-index-pane { border-left: none !important; border-top: 1px solid var(--line); overflow: visible !important; }

  /* Entry card (row layout): one column, stats in a line at the bottom */
  .m-entry-row { grid-template-columns: 1fr !important; gap: 14px !important; }
  .m-entry-row > :first-child { height: 140px !important; }
  .m-entry-row > :last-child { flex-direction: row !important; flex-wrap: wrap; align-items: center !important; text-align: left !important; }

  /* Hero search: button under the field instead of inside it */
  .m-search-btn { position: static !important; transform: none !important; width: 100%; justify-content: center; margin-top: 8px; }
  .m-search-input { padding-right: 16px !important; }
  .m-search-icon { top: 29px !important; } /* the field's middle, now the button sits below */

  /* Modals use the full width */
  .m-modal-wrap { padding: 12px !important; }
  .m-modal { width: 100% !important; }
}
