/* AniNet 2 brand.css.
   Two surfaces from one set of tokens:
   - light (default): home, projects, team, progress, labels, models and the
     other management pages. Light warm paper page, white cards, the organization's photos.
   - dark (body.theme-dark): the annotators and other imagery screens, so
     animals and masks read against a quiet background.
   App palette from Parker's reference images: ink black, sage, ochre, rust
   and cream. The header is ink on every page. Species colors are separate
   (aninet2/annotation_palette.py). Sans-serif for words; monospace only for
   data (codes, files). */

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

:root {
  /* app palette */
  --ink: #1C1C1A;
  --sage: #7FA39B;
  --ochre: #D8B04A;
  --rust: #B8683C;
  --cream: #EFE3C8;
  /* brighter annotation palette: tabs, header rule, buttons */
  --turquoise: #5EC4C8;
  --mustard: #F0B83A;
  --orange: #F58A3A;
  --green: #6FB85E;
  --coral: #F27A63;
  --blue: #8FB0EC;
  --paper-light: #FBF7EE;
  /* the same hues dark enough to read as text on cream */
  --sage-ink: #46675F;
  --rust-ink: #8E4A24;
  --ochre-ink: #7A5E14;

  /* older names, kept so every page follows the palette */
  --rose: var(--rust-ink);
  --leaf: var(--sage-ink);
  --gold: var(--ochre-ink);
  --teal-art: var(--sage-ink);
  --purple: var(--rust-ink);

  /* light surfaces */
  --bg: var(--paper-light);
  --panel: #FFFFFF;
  --panel-2: #F3ECDC;
  --line: #E6DCC6;
  --text: var(--ink);
  --muted: #57534A;
  --faint: #6F695C;

  --teal: var(--sage-ink);
  --teal-bright: var(--sage-ink);  /* links and interactive on light */
  --amber: var(--mustard);         /* primary buttons */
  --amber-ink: var(--ink);
  --accent: var(--rust-ink);       /* accent that reads as text on light */

  --flag: var(--rust-ink);
  --ok: #3E6B4A;
  --danger: #A63A2A;

  /* header: ink, with the palette's light hues for tabs */
  --head-bg: var(--ink);
  --head-text: var(--cream);
  --head-muted: #B9AF99;

  --paper: var(--paper-light);
  --font: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 8px;
  --shadow: 0 1px 2px rgba(28, 28, 26, 0.07), 0 2px 10px rgba(28, 28, 26, 0.05);
}

/* imagery screens stay dark */
body.theme-dark {
  --bg: #0F1416;
  --panel: #161C1E;
  --panel-2: #1B2325;
  --line: #263034;
  --text: #E6E4D8;
  --muted: #8A938F;
  --faint: #5A6662;
  --teal-bright: var(--sage);
  --amber: var(--ochre);          /* the dark annotator keeps its ochre */
  --accent: var(--ochre);
  --flag: #D98A5E;
  --ok: #9CC3B9;
  --danger: #E86A5A;
  --rose: var(--rust);
  --leaf: var(--sage);
  --gold: var(--ochre);
  --teal-art: var(--sage);
  --purple: var(--rust);
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14.5px; line-height: 1.5; }
a { color: var(--teal-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.005em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 13.5px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ── header: ink black on every page ──────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 14px;
  padding: 8px 20px; border-bottom: 3px solid var(--mustard);
  background: var(--head-bg); color: var(--head-text);
  position: sticky; top: 0; z-index: 20; }
/* the mark and the wordmark on a strip of their own cream paper */
.brand { display: flex; align-items: center; gap: 4px; color: var(--head-text);
  background: #ECE2C9; border-radius: 7px; padding: 2px 8px 2px 2px; }
.brand:hover { text-decoration: none; }
.brand .brand-mark { height: 34px; width: 34px; border-radius: 5px; display: block; }
.brand .brand-word { height: 24px; width: auto; display: block; }
.topbar .crumb { color: var(--head-muted); }
.crumb { color: var(--faint); }
.topbar select { background: #2A2A27; color: var(--head-text); border-color: #3A3A36; }

/* top navigation on the ink header: each tab keeps one palette color; muted
   until hovered, full when it is the page you are on */
.topnav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.navbtn { --c: var(--turquoise);
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  color: var(--c); background: transparent;
  border: 0; border-radius: 999px;
  padding: 5px 12px;
  transition: color .12s, background .12s; }
.navbtn:hover { background: color-mix(in srgb, var(--c) 18%, transparent); text-decoration: none; }
.navbtn:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }
.navbtn.on, .navbtn.on:hover { color: var(--ink); background: var(--c); font-weight: 600; }
.navbtn[data-c=turquoise] { --c: var(--turquoise); }
.navbtn[data-c=mustard] { --c: var(--mustard); }
.navbtn[data-c=orange] { --c: var(--orange); }
.navbtn[data-c=green] { --c: var(--green); }
.navbtn[data-c=coral] { --c: var(--coral); }
.navbtn[data-c=blue] { --c: var(--blue); }
.navbtn.quiet { color: var(--head-muted); font-weight: 400; font-size: 12.5px; }
.navbtn.quiet:hover { color: #E86A5A; background: transparent; border-bottom-color: transparent; }

/* who is signed in, for which organization */
.whoami { display: flex; align-items: center; gap: 10px; padding-left: 12px;
  margin-left: 4px; border-left: 1px solid #3A3A36; }
.whoami .orglogo { height: 30px; max-width: 90px; object-fit: contain; border-radius: 4px;
  background: var(--cream); padding: 2px; }
.whoami .names { display: flex; flex-direction: column; line-height: 1.2; }
.whoami .org { font-size: 13px; font-weight: 600; color: var(--head-text); }
.whoami .person { font-size: 12px; color: var(--head-muted); }
.whoami a.person:hover { color: var(--turquoise); }

/* ── layout ─────────────────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; }
body.theme-dark .panel { border-width: 0.5px; border-radius: 6px; padding: 14px 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 12px; }

/* small labels for data; plain words, not boxes */
.chip { font-family: var(--font); font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid transparent;
  border-radius: 4px; padding: 2px 8px; }
body.theme-dark .chip { font-family: var(--mono); font-size: 11.5px;
  background: var(--panel); border: 0.5px solid var(--line); padding: 3px 8px; }
.chip.teal { color: var(--teal-bright); }
body.theme-dark .chip.teal { border-color: #1E4552; }
.chip.flag { color: var(--flag); }
body.theme-dark .chip.flag { border-color: #57202F; }

button, .btn { font-family: var(--font); font-size: 13px; cursor: pointer;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; }
body.theme-dark button, body.theme-dark .btn { background: var(--panel-2);
  border-width: 0.5px; border-radius: 4px; }
button:hover, .btn:hover { border-color: var(--teal-bright); }
.btn-amber { background: var(--amber); color: var(--amber-ink);
  border: none; font-weight: 600; }
.btn-amber:hover { filter: brightness(1.05); border: none; text-decoration: none; }

input, select, textarea { background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-family: var(--font); font-size: 13.5px; }
body.theme-dark input, body.theme-dark select, body.theme-dark textarea {
  background: var(--panel-2); border-width: 0.5px; border-radius: 4px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-bright); }
label { font-size: 12.5px; color: var(--muted); display: block; margin: 10px 0 4px; }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); }
body.theme-dark th { font-weight: 500; font-size: 11.5px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 6px 10px; border-bottom-width: 0.5px; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
body.theme-dark td { padding: 7px 10px; border-bottom-width: 0.5px; }

.glyph { display: inline-block; }

.tilegrid { display: grid; gap: 2px; }
.tilegrid a { display: block; aspect-ratio: 1; background: var(--panel-2);
  border-radius: 2px; overflow: hidden; }
.tilegrid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.progress { height: 4px; background: var(--panel-2); border-radius: 2px; }
.progress > div { height: 100%; background: var(--teal-bright); border-radius: 2px; }

.login-card { max-width: 360px; margin: 12vh auto; }
.flash { color: var(--danger); font-size: 13px; margin: 8px 0; }

/* ── home and project cards ─────────────────────────────────────────── */
.home-head { display: flex; align-items: flex-end; gap: 18px; margin: 0 0 28px; }
.home-head .orglogo { height: 56px; max-width: 160px; object-fit: contain; }
.home-head h1 { margin: 0; font-size: 26px; }
.home-head .summary { color: var(--muted); font-size: 14px; margin-top: 2px; }
.home-head .actions { margin-left: auto; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted);
  margin: 30px 0 12px; }
.cards { display: grid; gap: 26px 22px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: block; color: var(--text); }
.card:hover { text-decoration: none; }
.card:hover .card-name { color: var(--teal-bright); }
.thumb { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden;
  border-radius: var(--r); background: var(--panel-2); }
.thumb img.pic { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; opacity: 0; transition: opacity .35s; }
.thumb img.pic.loaded { opacity: 1; }
.thumb.empty img.pic { display: none; }
.card:hover .thumb img.pic.loaded { filter: brightness(1.04); }
.card-name { font-size: 15px; font-weight: 600; margin: 10px 0 1px; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-meta .n { color: var(--text); font-variant-numeric: tabular-nums; }
.stat .n { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }

/* ── loading: the AniNet mark filling with watercolor (static/loading.svg) */
.ani-loading { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; pointer-events: none; }
.ani-loading img { width: 30%; max-width: 88px; min-width: 36px; height: auto; }
.ani-loading.inline { position: static; display: inline-flex; }
.ani-loading.inline img { width: 64px; }

/* the dark imagery screens keep their former sizes, so the annotator layout
   does not move */
body.theme-dark h1 { font-size: 19px; font-weight: 500; letter-spacing: 0; }
body.theme-dark h2 { font-size: 15px; font-weight: 500; }
body.theme-dark h3 { font-weight: bold; }
body.theme-dark .page { max-width: 1080px; padding: 20px 16px 60px; }
body.theme-dark .topbar { padding: 10px 16px; gap: 12px; border-bottom-width: 0.5px; }
body.theme-dark .navbtn { font-size: 12.5px; padding: 4px 10px; }
body.theme-dark label { font-size: 12px; }
body.theme-dark button, body.theme-dark .btn { padding: 7px 14px; }
body.theme-dark input, body.theme-dark select { padding: 7px 10px; }

/* a project with no picture yet */
.thumb.empty::after { content: ""; position: absolute; inset: 0;
  background: url("/static/brand/mark-128.png") center / 44px no-repeat; opacity: 0.35; }

/* the header never breaks a tab or a name over two lines */
.navbtn, .whoami .org, .whoami .person { white-space: nowrap; }
.whoami { flex: none; }
.topbar .crumb + a, .topbar .crumb + span { white-space: nowrap; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; }

/* where you are, above the page title (every page; the header stays one line) */
.crumbs { font-size: 13px; color: var(--muted); margin: -12px 0 14px; display: flex;
  gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--teal-bright); }
.crumbs .crumb { color: var(--faint); }
body.theme-dark .crumbs { font-size: 12.5px; margin: -8px 0 8px; }

/* the annotators' title row stays one line whatever it says (a long file
   name or status), so the image under it never moves; the status chip
   keeps one width and shows the whole message on hover */
.annbar { flex-wrap: nowrap; min-width: 0; min-height: 36px; }
.annbar > h1 { flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.annbar > .row, .annbar > .chip { flex: none; flex-wrap: nowrap; white-space: nowrap; }
.annbar #astatus { display: inline-block; width: 210px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center; vertical-align: middle; }

/* dark to the bottom edge of the window, however long the page is */
html:has(> body.theme-dark) { background: #0F1416; }
body.theme-dark { min-height: 100vh; }

/* ── project and home pages: annotated work, slowly panning (static/showcase.js) */
.showcase { position: relative; height: 280px; margin: 0 0 22px; overflow: hidden;
  border-radius: var(--r); background: var(--panel-2); }
.showcase.empty { display: none; }
.showcase-slide { position: absolute; inset: 0; opacity: 0;
  transition: opacity 1.4s ease-in-out; }
.showcase-slide.on { opacity: 1; }
.showcase-pan { position: absolute; left: 0; top: 0; will-change: transform;
  animation: showcase-pan var(--dur, 9s) linear both; }
.showcase-pan.again { animation-direction: alternate; animation-iteration-count: infinite;
  animation-timing-function: ease-in-out; }
.showcase.paused .showcase-pan { animation-play-state: paused; }
.showcase-pan img { width: 100%; height: 100%; display: block; }
@keyframes showcase-pan {
  from { transform: translate(var(--x0, 0), var(--y0, 0)); }
  to { transform: translate(var(--x1, 0), var(--y1, 0)); }
}
/* species names on the picture: bold text on an ink-black tag with a
   stripe of the species color, as in the annotators */
.showcase-label { position: absolute; transform: translateY(-115%);
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; color: #F7F2E6; line-height: 1.2;
  background: var(--ink); border-left: 3px solid var(--c, var(--sage));
  border-radius: 3px; padding: 2px 7px 2px 5px; }
.showcase-cap { position: absolute; left: 12px; bottom: 10px; margin: 0; z-index: 2;
  font-size: 12.5px; color: var(--text); background: rgba(239, 227, 200, 0.88);
  border-radius: 6px; padding: 3px 10px; max-width: calc(100% - 24px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.showcase-cap:empty { display: none; }
@media (max-width: 700px) { .showcase { height: 190px; } }
@media (prefers-reduced-motion: reduce) {
  .showcase-pan { animation: none; transform: translate(var(--x0, 0), var(--y0, 0)); }
  .showcase-slide { transition-duration: .4s; }
}

/* ── upload page: a warm drop area, the chosen files, a bar for each ────── */
.up-head p { max-width: 620px; margin: 0 0 22px; }
.up-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px;
  align-items: start; }
@media (max-width: 860px) { .up-layout { grid-template-columns: 1fr; } }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 250px; padding: 30px 20px; text-align: center; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--gold) 45%, var(--line)); border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 6%, var(--panel)),
              color-mix(in srgb, var(--teal-art) 5%, var(--panel)));
  transition: border-color .15s, background .15s, transform .15s; }
.dropzone:hover, .dropzone:focus-visible { outline: none;
  border-color: color-mix(in srgb, var(--gold) 80%, var(--line)); }
.dropzone.over { border-color: var(--leaf); transform: scale(1.01);
  background: color-mix(in srgb, var(--leaf) 9%, var(--panel)); }
.dz-mark { width: 64px; height: 64px; border-radius: 10px; margin-bottom: 6px; }
.dz-title { font-size: 19px; font-weight: 600; }
.dz-sub { font-size: 14px; color: var(--muted); }
.dz-link { color: var(--teal-bright); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--teal-bright) 40%, transparent);
  text-underline-offset: 3px; }
.dz-fine { font-size: 12.5px; color: var(--faint); margin-top: 8px; }
.detected { display: flex; align-items: center; gap: 10px; margin: 14px 0 0;
  padding: 10px 14px; border-radius: var(--r); font-size: 14px;
  background: color-mix(in srgb, var(--leaf) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--leaf) 30%, var(--line)); }
.detected img { width: 22px; height: 22px; border-radius: 4px; }
.up-files { display: grid; gap: 10px; margin-top: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.up-more { font-size: 13px; margin-top: 10px; }
.uf { position: relative; display: flex; gap: 10px; align-items: center; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.uf-pic { position: relative; flex: none; width: 64px; height: 48px; overflow: hidden;
  border-radius: 5px; background: var(--panel-2); }
.uf-pic > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uf-pic.has .ani-loading, .uf-pic.none .ani-loading { display: none; }
.uf-pic.none::after { content: attr(data-ext); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font: 500 11px var(--mono); color: var(--faint); }
.uf-pic .ani-loading img { width: 60%; min-width: 0; }
.uf.sending .uf-pic.has .ani-loading { display: flex; background: rgba(239, 227, 200, .55); }
.uf-body { flex: 1; min-width: 0; }
.uf-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uf-note { font-size: 12px; color: var(--muted); margin: 1px 0 5px; }
.uf .progress > div { width: 0; transition: width .2s; background: var(--gold); }
.uf.ok .progress > div { background: var(--leaf); }
.uf.ok .uf-note { color: var(--ok); }
.uf.bad .progress > div { background: var(--danger); }
.uf.bad .uf-note { color: var(--danger); }
.uf-x { position: absolute; top: 3px; right: 4px; border: 0; background: none; padding: 0 5px;
  font-size: 16px; line-height: 1; color: var(--faint); }
.uf-x:hover { color: var(--danger); border: 0; }
.uf.sending .uf-x, .uf.ok .uf-x, .uf.bad .uf-x { display: none; }
.up-side h2 { margin-bottom: 2px; }
.up-side input, .up-side select { width: 100%; }
.up-help { font-size: 12px; color: var(--faint); margin: 5px 0 0; }
.up-go { width: 100%; margin-top: 16px; padding: 10px 14px; font-size: 14px; }
.up-go:disabled { opacity: .55; cursor: default; filter: none; }
.up-status { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 10px 0 6px;
  font-size: 13px; }
.up-status .ani-loading.inline img { width: 34px; }
.up-status .ani-loading[hidden] { display: none; }
.up-done { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.detected[hidden], .up-done[hidden], .up-more[hidden] { display: none; }
