:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-2: #1b2330;
  --line: #263041;
  --ink: #e6edf3;
  --ink-dim: #9aa7b8;
  --ink-faint: #6b7887;
  --accent: #4ea3ff;
  --accent-warm: #ffb648;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.1rem 3rem; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }

/* --- header --------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 1.2rem;
  padding: .75rem 1.1rem;
  background: linear-gradient(180deg, #121924, #0e141d);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-size: 1.32rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
}
.brand span { color: var(--accent); }
.search { flex: 1; display: flex; gap: .4rem; max-width: 620px; }
.search input {
  flex: 1; padding: .5rem .8rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search button {
  padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); cursor: pointer;
}
.search button:hover { background: #232d3d; }
.nav { display: flex; gap: 1rem; font-size: .92rem; }
.nav a { color: var(--ink-dim); }

/* --- photo grid ----------------------------------------------------- */
.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  /* Cards differ in height now that each one keeps its photograph's shape,
     so they hang from the top of the row instead of stretching to match. */
  align-items: start;
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
/* No fixed aspect and no cover: a 3/2 box crops anything that is not 3/2,
   and Bas crops his frames per photograph. The card follows the picture. */
.card img { width: 100%; height: auto; display: block; background: #000; }
.card-body { padding: .65rem .8rem .8rem; }
.card-title { font-weight: 600; font-size: .95rem; margin: 0 0 .15rem; }
.card-meta { font-size: .82rem; color: var(--ink-dim); margin: 0; }

/* --- dossier -------------------------------------------------------- */
.dossier-head {
  display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start;
  padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem;
}
.ident { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.ident-sub { font-size: 1.05rem; color: var(--ink-dim); margin: .15rem 0 0; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; padding: .16rem .5rem; border-radius: 99px;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.badge.confirmed { color: var(--ok); border-color: #1f4d2b; background: #0f2416; }
.badge.probable { color: var(--warn); border-color: #4d3d0f; background: #241d0d; }
.badge.unconfirmed { color: var(--bad); border-color: #5a2320; background: #26100f; }
.badge.mil { color: var(--accent-warm); border-color: #4d3a15; background: #241c0c; }
.badge.live { color: var(--ok); border-color: #1f4d2b; background: #0f2416; }

.facts {
  display: grid; gap: .1rem 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0 0 1.6rem;
}
.fact { padding: .45rem 0; border-bottom: 1px solid #1b2230; }
.fact dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.fact dd { margin: .1rem 0 0; font-size: .98rem; }

/* the c/n is a first-class link, so make it look like a destination */
.cn-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.02rem; padding: .06rem .38rem; border-radius: 4px;
  background: #16283d; border: 1px solid #24425f; color: #7cc0ff;
}
.cn-link:hover { background: #1d3550; text-decoration: none; }

section.block { margin: 2rem 0; }
section.block > h2 {
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-dim); border-bottom: 1px solid var(--line);
  padding-bottom: .4rem; margin-bottom: .9rem; font-weight: 600;
}

/* --- timeline ------------------------------------------------------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li {
  position: relative; padding: 0 0 1.15rem 1.5rem;
  border-left: 2px solid var(--line);
}
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -6px; top: .42rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent);
}
.timeline .when {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint);
}
.timeline .what { font-weight: 600; margin: .05rem 0 .2rem; }
.timeline .detail { color: var(--ink-dim); font-size: .93rem; margin: 0; }

.tag-kind {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 .3rem; margin-left: .4rem;
}

/* --- tables --------------------------------------------------------- */
table.rows { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.rows th, table.rows td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid #1b2230; }
table.rows th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
table.rows tr:hover td { background: #131a24; }

/* --- notes ---------------------------------------------------------- */
.note {
  border-left: 3px solid var(--warn); background: #1c1a12;
  padding: .7rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1.1rem;
}
.note.bad { border-left-color: var(--bad); background: #1e1211; }
.note.info { border-left-color: var(--accent); background: #101a26; }
.note p { margin: .25rem 0; }
.note strong { color: var(--ink); }

/* --- photo page ----------------------------------------------------- */
.photo-hero {
  display: block; position: relative; background: #000;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.photo-hero img { width: 100%; display: block; }
.photo-hero .zoom-hint {
  position: absolute; right: .6rem; bottom: .6rem;
  font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: #dfe8f2; background: rgba(6, 12, 20, .72);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 99px;
  padding: .2rem .6rem; opacity: 0; transition: opacity .15s;
}
.photo-hero:hover .zoom-hint, .photo-hero:focus-visible .zoom-hint { opacity: 1; }

/* Full size, over the page. The image is capped to the viewport so a 1920px
   frame is shown whole rather than cropped by the window. */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(4, 7, 12, .93);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  /* min-width/min-height default to `auto` on a flex item, and for an image
     that means its own 1920px. max-width:100% loses to that floor, so the
     picture ran off the right-hand edge instead of shrinking. These two lines
     are the fix; the max-* pair alone was never enough. */
  min-width: 0; min-height: 0;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto; object-fit: contain; display: block;
}
.photo-cols { display: grid; gap: 1.6rem; grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr); }
@media (max-width: 860px) { .photo-cols { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; padding: .45rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: .9rem;
}
.btn:hover { background: #232d3d; text-decoration: none; }

pre.xmp {
  background: #0a0e14; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; overflow-x: auto; font-size: .78rem; color: #b9c9d8;
}

/* --- radar ---------------------------------------------------------- */
#map { height: 68vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); }
.radar-bar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: .9rem; }
.radar-bar label { font-size: .9rem; color: var(--ink-dim); display: flex; gap: .35rem; align-items: center; }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--ink-dim); margin-top: .6rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .3rem; }
.dot.mil { background: var(--accent-warm); }
.dot.civ { background: var(--accent); }
.dot.known { background: var(--ok); }

.foot {
  border-top: 1px solid var(--line); padding: 1.4rem 1.1rem 2.4rem;
  color: var(--ink-faint); font-size: .85rem; text-align: center;
}
.foot p { margin: .2rem 0; }

.empty { color: var(--ink-faint); font-style: italic; padding: 1.4rem 0; }

/* --- login ---------------------------------------------------------- */
form input[type=text], form input[type=password] {
  width: 100%; padding: .55rem .8rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-size: 1rem;
}
form input[type=text]:focus, form input[type=password]:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
/* Logout has to be a POST, so it is a button that must not look like one. */
.nav button.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--ink-dim); font: inherit; font-size: .92rem;
}
.nav button.linkish:hover { color: var(--ink); text-decoration: underline; }
.badge.attested { color: #7cc0ff; border-color: #24425f; background: #16283d; }

/* --- grouped overview ------------------------------------------------ */
.btn-on { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn-on .faint { color: #06121f; opacity: .7; }
.count-pill {
  font-size: .72rem; font-weight: 600; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 99px; padding: .05rem .45rem;
  margin-left: .35rem; vertical-align: middle;
}
