/* lmal.se – Artregister
   Hand-written CSS (no build step). The values come from the inline styles of the old Next.js site. */

/* Padding and borders count inside an element's width, so `width: 100%` boxes never spill into their neighbours. */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: #0f1115;
  color: white;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[x-cloak] { display: none !important; }

a { color: inherit; }

button, input, select, textarea { font-family: inherit; }

/* The site is dark-only: let native widgets (dropdown lists, scrollbars, date pickers) render dark too. */
:root { color-scheme: dark; }
select option, select optgroup { background: #151a24; color: #fff; }

/* ---------- Page shells ---------- */

.page {
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(30, 58, 138, 0.18), transparent 35%), #070b14;
  color: #ffffff;
}

.container { max-width: 1140px; margin: 0 auto; padding: 42px 24px 80px; }
.container--detail { max-width: 1180px; padding: 40px 24px 80px; }
.container--narrow { max-width: 1100px; padding: 48px 24px 80px; }

.page-title {
  margin: 0;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-lead {
  margin: 18px 0 0;
  color: #a3acba;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.5;
  max-width: 760px;
}

.header-block { margin-bottom: 28px; }
.divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 28px 0; }
.divider--tight { margin: 28px 0 18px; }

.back-link { color: #93a0b8; text-decoration: none; font-size: 16px; }
.back-row { margin-bottom: 20px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  color: #fff;
  font-weight: 700;
}
.badge--square { padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1; }
.badge--pill { padding: 10px 14px; border-radius: 999px; font-size: 15px; }
.badge-row { display: flex; flex-wrap: wrap; }
.badge-row--cards { gap: 10px; margin-top: 18px; }

/* ---------- Filters ---------- */

.filters { margin-bottom: 28px; }
.filters-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.search-input {
  flex: 1;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  box-sizing: border-box;
}

.btn-ghost {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 700;
  font-size: 13.33px;
  cursor: pointer;
}
.btn-ghost--blue { color: #8db7ff; }

.active-labels { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.active-label {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.2);
  border: 1px solid rgba(86, 156, 255, 0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.filter-panel {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-grid {
  display: grid;
  gap: 18px;
  align-items: start;
  grid-template-columns: minmax(320px, 1.4fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(220px, 1fr);
}

.filter-box { min-width: 0; }
.filter-box-title { font-size: 16px; font-weight: 800; color: #fff; margin-bottom: 10px; }
.filter-box-body { overflow-x: hidden; }
.filter-box-body--scroll { max-height: 210px; overflow-y: auto; padding-inline-end: 6px; }

.chip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip-col { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; width: 100%; }

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: start;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
.chip.is-active { border-color: rgba(86, 156, 255, 0.9); background: rgba(13, 110, 253, 0.22); }

.range-grid { display: grid; grid-template-columns: minmax(70px, auto) 1fr 1fr; gap: 10px; align-items: center; }
.range-label { font-size: 15px; font-weight: 800; color: #fff; }

.num-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  min-width: 0;
}

/* ---------- Result list ---------- */

.result-count { margin: 0 0 28px; color: #a3acba; font-size: 16px; }

.empty-card {
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
}
.empty-card h2 { margin: 0 0 10px; font-size: 24px; }
.empty-card p { margin: 0; color: #aeb6c6; font-size: 17px; line-height: 1.6; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.card-link { text-decoration: none; color: inherit; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.card-image {
  height: 220px;
  background-size: cover;
  background-position: center;
  background-color: #0b0f18;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8aa0;
  font-size: 20px;
}
.card-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px; }
.card-title { margin: 0; font-size: 32px; overflow-wrap: anywhere; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.card-sub { margin: 10px 0 0; font-size: 16px; color: #aeb6c6; line-height: 1.4; }

/* ---------- Species page: hero + gallery ---------- */

.species-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 28px;
}

.species-hero-image {
  min-height: 420px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
  background-color: #0b0f18;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8aa0;
  font-size: 22px;
  padding: 0;
  cursor: default;
}
.species-hero-image.has-image { cursor: zoom-in; }
.species-hero-image { position: relative; }
.species-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.species-hero-right { display: flex; flex-direction: column; justify-content: flex-start; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.species-name {
  font-size: clamp(44px, 7vw, 74px);
  line-height: 0.95;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.species-latin {
  margin-top: 14px;
  font-size: clamp(24px, 4vw, 38px);
  color: #c6ceda;
  font-style: italic;
  line-height: 1.1;
}

.species-thumb-grid-desktop { margin-top: 26px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.species-thumb-grid-mobile { display: none; }
.species-thumb-toggle { grid-column: 1 / -1; }

.species-thumb-link { display: block; text-decoration: none; background: transparent; padding: 0; margin: 0; border: 0; cursor: pointer; }
.species-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-color: #0b0f18;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.82;
  transition: all 0.15s ease;
}
.species-thumb.is-active {
  border: 2px solid rgba(141, 183, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  opacity: 1;
}

/* Full-screen viewer */
.species-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.species-viewer-inner { width: min(1200px, 100%); display: grid; gap: 16px; }
.species-viewer-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.species-viewer-actions { display: flex; gap: 10px; align-items: center; }
.species-viewer-actions a.species-viewer-button { text-decoration: none; }
.species-viewer-count { color: #c6ceda; font-size: 14px; font-weight: 700; }
.species-viewer-image {
  position: relative;
  min-height: 70vh;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: #0b0f18;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.species-viewer-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.species-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 11, 20, 0.7);
  color: #fff;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.species-viewer-nav-left { left: 14px; }
.species-viewer-nav-right { right: 14px; }
.species-viewer-thumbs { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.species-viewer-thumb-button { flex: 0 0 120px; background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; }
.species-viewer-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-color: #0b0f18;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.species-viewer-thumb.is-active {
  border: 2px solid rgba(141, 183, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* ---------- Species page: facts + text ---------- */

.species-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 38px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fact-card {
  padding: 18px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.fact-label { font-size: 14px; color: #8f98aa; margin-bottom: 8px; }
.fact-value { font-size: 22px; font-weight: 700; color: #ffffff; line-height: 1.2; }

.species-content { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px; align-items: start; }

.text-section { margin-bottom: 34px; }
.text-section h2 { font-size: 32px; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.02em; }
.text-section-body { color: #c1c9d6; font-size: 20px; line-height: 1.7; }
.text-section-body p { margin: 0 0 1em; white-space: pre-line; }
.text-section-body p:last-child { margin-bottom: 0; }
.text-section-toggle { margin-top: 14px; }

.side-card {
  margin-bottom: 24px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.side-card h2 { font-size: 28px; margin: 0 0 16px; font-weight: 800; }
.origin-box {
  border-radius: 16px;
  min-height: 180px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.18), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c5cedb;
  font-size: 22px;
  text-align: center;
  padding: 20px;
}
.origin-box--compact { min-height: 0; padding: 14px 16px; font-size: 20px; }

/* Map of the origin (Leaflet + OpenStreetMap). `isolation` keeps Leaflet's high z-index panes under the site header. */
.origin-map {
  height: 280px;
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0f18;
  isolation: isolate;
}
/* The standard tiles are bright: take the edge off so the map sits in the dark theme. Delete this rule for the plain look. */
.origin-map .leaflet-tile-pane { filter: brightness(0.78) contrast(1.05) saturate(0.85); }
.origin-map .leaflet-control-attribution { background: rgba(11, 15, 24, 0.78); color: #aab3c5; }
.origin-map .leaflet-control-attribution a { color: #8db7ff; }
.origin-map .leaflet-bar a { background: #121826; color: #e4e9f2; border-bottom-color: rgba(255, 255, 255, 0.12); }
.origin-map .leaflet-bar a:hover { background: #1b2437; }
.origin-map.leaflet-container { font-family: inherit; } /* Leaflet adds the class to the element itself */
.origin-map--editor { height: 300px; cursor: crosshair; }

/* ---------- Admin ---------- */

.admin-page { min-height: 100vh; background: #070b14; color: #fff; padding: 24px; }
.admin-container { max-width: 1000px; margin: 0 auto; }
.admin-container--wide { max-width: 1100px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-link { color: #8db7ff; text-decoration: none; }
.admin-list { display: grid; gap: 12px; }
.admin-list-item {
  display: block;
  padding: 16px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-list-item small { display: block; color: #aeb6c6; margin-top: 4px; font-size: 16px; }
.link-button { background: none; border: 0; padding: 0; color: #8db7ff; font-size: 16px; cursor: pointer; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: #070b14; color: #fff; padding: 24px; }
.login-form {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.login-form h1 { margin: 0 0 16px; }
.login-form .input { margin-bottom: 12px; }
.form-error { color: #ff9b9b; }
.btn-primary {
  padding: 16px 22px;
  border-radius: 12px;
  border: 0;
  background: #0d6efd;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-primary--block { width: 100%; margin-top: 2px; padding: 14px 16px; }

/* Editor inputs */
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
  outline: none;
}
textarea.input { font-size: 18px; min-height: 160px; }
.input--prose { font-size: 20px; color: #c1c9d6; }
.input--small { padding: 10px 12px; border-radius: 10px; font-size: 18px; font-weight: 700; line-height: 1.2; }
.input--hero { padding: 10px 0; border: 0; background: transparent; line-height: 1.1; border-radius: 0; }
.input--hero-name { font-size: clamp(44px, 7vw, 74px); font-weight: 800; letter-spacing: -0.04em; }
.input--hero-latin { font-size: clamp(24px, 4vw, 38px); font-style: italic; color: #c6ceda; margin-top: 10px; }

.editor-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: stretch; margin-bottom: 28px; }
.editor-hero-left { display: grid; gap: 14px; }
.editor-hero-right { display: flex; flex-direction: column; justify-content: center; }
.editor-hero-image { min-height: 420px; }
.editor-short-box { margin-top: 24px; padding: 22px; border-radius: 18px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.editor-short-box textarea { min-height: 130px; background: transparent; border: 0; padding: 0; font-size: 22px; color: #d5dbe5; }
.editor-badges { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.editor-panel { padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.editor-panel--small { padding: 14px; border-radius: 14px; }
.editor-panel-label { font-size: 14px; color: #a9b3c5; margin-bottom: 10px; }
.editor-panel input[type="file"] { color: #fff; }
.upload-status { margin-top: 10px; font-size: 14px; color: #a9b3c5; }
.upload-message { margin-top: 10px; font-size: 14px; font-weight: 700; }
.msg-ok { color: #8db7ff; }
.msg-error { color: #ff9b9b; }

.stack { display: grid; gap: 14px; }
.stack--tight { gap: 8px; }
.origin-help { font-size: 13px; color: #8f98aa; line-height: 1.5; }
.origin-help span { color: #d5dbe5; font-weight: 700; }

.gallery-list { display: grid; gap: 12px; }
.gallery-item { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.gallery-item-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #0b0f18;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.gallery-item-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.gallery-item-path { font-size: 13px; color: #a9b3c5; line-height: 1.5; word-break: break-all; }
.muted-box { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); color: #a9b3c5; line-height: 1.5; font-size: 14px; }
.preview-box { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06); color: #cfd7e6; line-height: 1.5; }
.preview-box-label { font-size: 13px; color: #8f98aa; margin-bottom: 6px; }

/* AI image generation panel in the species editor */
.gen-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.gen-angles { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-angle { padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.04); color: #d5dbe5; font-size: 14px; cursor: pointer; }
.gen-angle.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
.gen-refs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.gen-ref { position: relative; width: 84px; height: 84px; border-radius: 10px; background-size: cover; background-position: center; border: 1px solid rgba(255, 255, 255, 0.12); }
.gen-ref[role="button"] { cursor: pointer; }
.gen-ref.is-selected { border: 2px solid #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35); }
.gen-ref-remove { position: absolute; top: 2px; inset-inline-end: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.gen-radio { display: block; margin-bottom: 6px; color: #d5dbe5; }
.gen-preview { width: 100%; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); }

.save-row { margin-top: 28px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.save-message { font-weight: 700; }
.error-list { margin: 0 0 18px; padding: 14px 18px 14px 32px; border-radius: 12px; background: rgba(220, 38, 38, 0.12); border: 1px solid rgba(220, 38, 38, 0.4); color: #ffb4b4; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .species-hero, .editor-hero { grid-template-columns: 1fr; }
  .species-hero-image { min-height: 340px; }
  .species-thumb-grid-desktop { display: none; }
  .species-thumb-grid-mobile { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; margin-bottom: 28px; }
  .species-thumb-link { min-width: 0; }
  .species-viewer-image { min-height: 52vh; }
  .species-facts { grid-template-columns: repeat(2, 1fr); }
  .species-content { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .species-hero-image { min-height: 260px; }
  .species-viewer-overlay { padding: 14px; }
  .species-viewer-image { min-height: 42vh; }
  .species-viewer-thumb-button { flex: 0 0 96px; }
  .species-viewer-nav { width: 42px; height: 42px; font-size: 22px; }
}

/* ---------- Site header (login, collection, admin) ---------- */

:root { --nav-h: 52px; }

.page, .login-wrap, .admin-page { min-height: calc(100vh - var(--nav-h)); }

.site-nav {
  position: relative;
  z-index: 20;
  min-height: var(--nav-h);
  box-sizing: border-box;
  background: #0b0f18;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.site-nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.site-nav-brand { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; color: #fff; }
.site-nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 20px; }
.site-nav-link {
  color: #a3acba;
  text-decoration: none;
  font-size: 16px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.site-nav-link:hover { color: #fff; }
.site-nav-link.is-active { color: #fff; border-bottom-color: #0d6efd; }
.site-nav-logout { margin: 0; }
.site-nav-button { background: none; border: 0; border-radius: 0; cursor: pointer; font-family: inherit; }
.site-nav-toggle {
  display: none;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.flash {
  max-width: 1092px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 16px;
  box-sizing: border-box;
}
.flash--ok { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); color: #b7f0c8; }
.flash--error { background: rgba(220, 38, 38, 0.12); border: 1px solid rgba(220, 38, 38, 0.4); color: #ffb4b4; }
@media (max-width: 1140px) { .flash { margin-inline-start: 24px; margin-inline-end: 24px; } }

/* ---------- Forms: register, password, account ---------- */

.form-help { margin: 0 0 14px; color: #a3acba; line-height: 1.5; }
.form-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0 0; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; color: #c1c9d6; cursor: pointer; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.login-form h2 { margin: 0 0 14px; font-size: 20px; }
.login-form--danger { border-color: rgba(220, 38, 38, 0.3); }
.btn-danger {
  padding: 14px 16px;
  border-radius: 12px;
  border: 0;
  background: #b42318;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }
.account-grid .login-form { max-width: none; }
.role-badge {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #c1c9d6;
  font-size: 14px;
  font-weight: 600;
}
.role-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.role-form .role-badge { margin-inline-start: 0; }

/* ---------- Featured rows and collection ---------- */

.featured { margin-top: 8px; }
.featured-title { margin: 28px 0 14px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.featured-title:first-child { margin-top: 0; }
.featured-hint { margin: 14px 0 0; color: #a3acba; }
.card-cell { display: flex; flex-direction: column; min-width: 0; }
.card-cell .card-link { display: block; }
.card-action { padding: 10px 4px 0; }

.back-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.collection-action { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.collection-action form { margin: 0; }
a.btn-ghost { display: inline-block; text-decoration: none; }

/* ---------- Admin: sub-navigation and user list ---------- */

.admin-subnav { display: flex; flex-wrap: wrap; gap: 0 22px; margin-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.admin-subnav-link { color: #a3acba; text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-subnav-link:hover { color: #fff; }
.admin-subnav-link.is-active { color: #fff; border-bottom-color: #0d6efd; }
.user-search .input { min-width: 240px; }
.user-table-wrap { overflow-x: auto; }
.user-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.user-table th, .user-table td { text-align: start; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.user-table th { color: #a3acba; font-weight: 600; white-space: nowrap; }
.pager { display: flex; justify-content: center; gap: 18px; margin-top: 18px; color: #a3acba; }


@media (max-width: 640px) {
  /* The links fold into a dropdown once Alpine has started (.is-js); without JavaScript they stay a wrapping row. */
  .site-nav-toggle { display: inline-block; }
  .site-nav.is-js .site-nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    padding-bottom: 10px;
  }
  .site-nav.is-js .site-nav-links.is-open { display: flex; }
  .site-nav.is-js .site-nav-link { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: start; }
  .site-nav.is-js .site-nav-link.is-active { border-bottom-color: #0d6efd; }
  .site-nav-button { width: 100%; }

  /* Two cards per row: compact cards with latin name and tags. */
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { border-radius: 12px; }
  .card-image { height: 110px; font-size: 12px; text-align: center; padding: 4px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 16px; }
  .card-sub { margin-top: 4px; font-size: 12px; }
  .badge-row--cards { gap: 4px; margin-top: 8px; }
  .featured-title { font-size: 19px; }
}

/* ---------- Editor: thumbnails, drag to main image ---------- */
.editor-thumb-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.editor-thumb { position: relative; cursor: grab; min-width: 0; }
.editor-thumb .species-thumb { opacity: 1; }
.editor-thumb-remove {
  position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 18px; line-height: 1;
}
.editor-thumb-main {
  position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 4px 6px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 12px; opacity: 0; transition: opacity 0.15s ease;
}
.editor-thumb:hover .editor-thumb-main, .editor-thumb:focus-within .editor-thumb-main { opacity: 1; }
@media (hover: none) { .editor-thumb-main { opacity: 1; } }
.editor-thumb-add {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; cursor: pointer; font-size: 32px; color: #a9b3c5;
  border: 2px dashed rgba(255, 255, 255, 0.2); border-radius: 14px;
}
.editor-thumb-add input { display: none; }
.editor-hero-image.is-drop-target { outline: 2px dashed rgba(141, 183, 255, 0.7); outline-offset: 4px; }
.editor-hero-image.is-drop-active { outline-style: solid; outline-color: rgba(141, 183, 255, 1); }
.drop-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(11, 15, 24, 0.7); color: #fff; font-size: 22px; font-weight: 700; padding: 16px; pointer-events: none;
}
.input--text-section { background: transparent; border-color: transparent; resize: none; overflow: hidden; line-height: 1.7; }
.input--text-section:focus { border-color: rgba(141, 183, 255, 0.6); }

/* Origin search in the editor ("Hitta på kartan") */
.origin-search { display: flex; gap: 8px; }
.origin-search .input { flex: 1; min-width: 0; font-size: 16px; }
.origin-results { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.origin-result {
  width: 100%; text-align: start; padding: 10px 12px; border-radius: 12px; cursor: pointer; color: #e4e9f2; font-size: 14px; line-height: 1.4;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
}
.origin-result:hover, .origin-result.is-active { border-color: rgba(141, 183, 255, 0.7); background: rgba(37, 99, 235, 0.14); }
.origin-result small { display: block; color: #8f98aa; }

/* ---------- Avatars (whole site) ---------- */

.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.avatar--initials {
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; line-height: 1; letter-spacing: 0.02em;
  user-select: none;
}
.site-nav-avatar { display: inline-flex; line-height: 0; }
.nav-badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-inline-start: 4px; border-radius: 999px; background: #0d6efd; color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1.5; text-align: center; vertical-align: 2px;
}
.account-avatar { margin-bottom: 14px; }
.login-form--wide { max-width: none; }
.login-form h3 { margin: 22px 0 10px; font-size: 17px; }
.notification-matrix td, .notification-matrix th { padding: 8px 12px; }
.notification-matrix input[type="checkbox"] { width: 18px; height: 18px; }
.blocked-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.blocked-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.blocked-list form { margin: 0; }

/* ---------- Forum (PLAN.md section 16) ---------- */

.forum-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.forum-crumb { color: #8db7ff; text-decoration: none; }
.forum-search, .forum-search-form .forum-search-options { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.forum-search .input { min-width: 240px; width: auto; }
.forum-search-form .input { margin-bottom: 12px; }
.forum-search-options label { display: flex; align-items: center; gap: 8px; color: #a9b3c5; font-size: 14px; }
.forum-search-options .input { width: auto; margin: 0; font-weight: 400; font-size: 16px; }
.forum-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 18px 0; }
.forum-actions form { margin: 0; }
a.btn-primary { display: inline-block; text-decoration: none; }

.forum-list { display: grid; gap: 12px; }
.forum-card, .forum-thread, .forum-result {
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08); text-decoration: none; color: inherit; box-sizing: border-box;
}
.forum-card:hover, a.forum-thread:hover { border-color: rgba(141, 183, 255, 0.5); }
.forum-result { display: block; margin-bottom: 12px; }
.forum-thread.is-unread { border-color: rgba(13, 110, 253, 0.55); }
.forum-thread.is-unread .forum-thread-title a { font-weight: 800; }
.forum-thread-main { min-width: 0; flex: 1 1 420px; }
.forum-thread-title { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; overflow-wrap: anywhere; }
.forum-thread-title a { text-decoration: none; }
.forum-thread-title a:hover { color: #8db7ff; }
.forum-thread-meta { color: #a3acba; font-size: 15px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.forum-thread-stats { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; color: #a3acba; font-size: 14px; text-align: end; }
.forum-new { margin-inline-start: 8px; padding: 2px 8px; border-radius: 999px; background: #0d6efd; color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; vertical-align: 3px; }
.forum-has-images { display: inline-flex; margin-inline-start: 8px; color: #9aa3b2; vertical-align: -2px; }
.forum-badge { padding: 4px 10px; font-size: 12px; background: #5f6673; margin-inline-end: 6px; vertical-align: 3px; }
.forum-badge--locked { background: #b96a16; }
.forum-admin-badge { padding: 2px 8px; font-size: 11px; background: #2563eb; }
.forum-result-excerpt { margin: 0 0 8px; color: #c1c9d6; line-height: 1.6; overflow-wrap: anywhere; }
.forum-result-excerpt mark, .forum-result mark { background: rgba(250, 204, 21, 0.3); color: #fff; border-radius: 3px; padding: 0 2px; }
.forum-title { overflow-wrap: anywhere; }

.forum-author { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.forum-author-avatar { display: inline-flex; line-height: 0; }
.forum-author-text { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.forum-author-name { color: #fff; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.forum-author-name--deleted { color: #8f98aa; font-style: italic; font-weight: 400; }
.forum-author-handle { color: #8f98aa; font-size: 14px; }
.forum-author--stacked { display: block; }
.forum-author--stacked .forum-author-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

.forum-posts { display: grid; gap: 14px; }
.forum-post {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.forum-post:target { border-color: rgba(141, 183, 255, 0.7); }
.forum-post-author { min-width: 0; }
.forum-post-avatar { display: inline-flex; line-height: 0; margin-bottom: 8px; }
.forum-post-main { min-width: 0; }
.forum-post-head { display: flex; gap: 10px; align-items: center; color: #8f98aa; font-size: 14px; margin-bottom: 10px; }
.forum-post-link { color: inherit; text-decoration: none; }
.forum-edited { font-style: italic; }
.forum-deleted { color: #8f98aa; font-style: italic; margin: 0; }
.forum-text { color: #d3dae6; font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.forum-text > :first-child { margin-top: 0; }
.forum-text > :last-child { margin-bottom: 0; }
.forum-text p { margin: 0 0 12px; }
.forum-text a { color: #8db7ff; }
.forum-text blockquote { margin: 0 0 12px; padding: 4px 0; padding-inline-start: 14px; border-inline-start: 3px solid rgba(255, 255, 255, 0.2); color: #aeb6c6; }
/* Quote boxes: a copy of an earlier post (PLAN.md §19.3), clearly apart from the text the author wrote. */
.forum-quote { position: relative; margin: 0 0 14px; padding: 10px 14px; border: 1px solid rgba(141, 183, 255, 0.28); border-inline-start: 4px solid #8db7ff; border-radius: 12px; background: rgba(141, 183, 255, 0.06); }
.forum-quote .forum-text { max-height: 15rem; overflow-y: auto; font-size: 15px; line-height: 1.55; }
.forum-quote-head { margin-bottom: 6px; color: #aeb6c6; font-size: 13px; }
.forum-quote-author { color: #e7ecf5; font-weight: 600; }
.forum-quote-time { color: inherit; }
.forum-quote--deleted { border-color: rgba(255, 255, 255, 0.15); border-inline-start-color: rgba(255, 255, 255, 0.3); background: transparent; }
.forum-quote-gone { margin: 0; color: #8a93a6; font-style: italic; }
.forum-quote-chips { margin-bottom: 12px; }
.forum-quote-chip { padding-inline-end: 40px; }
.forum-quote-excerpt { color: #d3dae6; font-size: 14px; overflow-wrap: anywhere; }
.forum-quote-chip .editor-thumb-remove { top: 8px; inset-inline-end: 8px; }
.forum-text code { padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); font-size: 0.92em; }
.forum-text pre { padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); overflow-x: auto; }
.forum-text pre code { padding: 0; background: none; }
.forum-text ul, .forum-text ol { margin: 0 0 12px; padding-inline-start: 24px; }
.forum-mention { font-weight: 700; text-decoration: none; }
.forum-translation-note { margin: 8px 0 0; color: #8f98aa; font-size: 13px; }
.forum-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.forum-image { display: block; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.1); line-height: 0; background: rgba(255, 255, 255, 0.03); }
.forum-image img { width: 100%; height: 150px; object-fit: cover; }
.forum-post-actions { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.forum-post-actions form { margin: 0; }
.link-button { text-decoration: none; }
.forum-post-actions .link-button, .forum-report > summary { font-size: 14px; color: #8db7ff; cursor: pointer; list-style: none; }
.forum-report > summary::-webkit-details-marker { display: none; }
.forum-report form { margin-top: 8px; display: grid; gap: 8px; max-width: 420px; }
.forum-report textarea { min-height: 80px; font-size: 15px; }
.forum-moderate { position: relative; }
.forum-moderate > summary { list-style: none; cursor: pointer; display: inline-block; }
.forum-moderate-menu { display: grid; gap: 8px; margin-top: 8px; padding: 12px 14px; border-radius: 12px; background: #11151f; border: 1px solid rgba(255, 255, 255, 0.12); }
.forum-moderate-menu form { margin: 0; }
.forum-reply-title { margin: 0 0 14px; }
.forum-report-quote { margin: 8px 0 14px; padding: 8px 14px; border-inline-start: 3px solid rgba(255, 255, 255, 0.2); color: #c1c9d6; }

.forum-composer { display: grid; gap: 10px; }
.forum-toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.forum-toolbar .btn-ghost { padding: 8px 12px; }
.forum-textarea { min-height: 200px; resize: vertical; font-size: 17px; }
.forum-body-wrap { position: relative; }
.forum-composer.is-dragging .forum-textarea { outline: 2px dashed #5aa2ff; outline-offset: 2px; }
.forum-composer.is-dragging .forum-body-wrap::after { content: "Drop pictures here"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(13, 110, 253, 0.16); border-radius: 12px; font-size: 20px; font-weight: 700; pointer-events: none; }
.forum-suggest {
  position: absolute; z-index: 30; left: 0; right: 0; margin: 4px 0 0; padding: 6px; list-style: none; border-radius: 12px;
  background: #11151f; border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.forum-suggest li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.forum-suggest li.is-active, .forum-suggest li:hover { background: rgba(13, 110, 253, 0.25); }
.forum-suggest small { color: #8f98aa; }
.forum-composer-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #8f98aa; font-size: 13px; margin: 0; }
.forum-composer-meta .is-over { color: #ff9b9b; font-weight: 700; }
.forum-attach { display: grid; gap: 10px; }
.forum-attach-list { display: flex; gap: 10px; flex-wrap: wrap; }
.forum-attach-item { position: relative; width: 110px; height: 110px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); }
.forum-attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.forum-attach-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(7, 11, 20, 0.7); font-size: 13px; }
.forum-attach-add { display: inline-block; justify-self: start; cursor: pointer; }

.forum-profile { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.forum-profile--compact { gap: 14px; }
.forum-profile .page-title { font-size: 34px; }
.forum-profile--compact .page-title { font-size: 26px; }

.messages { display: grid; gap: 12px; }
.message {
  max-width: 85%; padding: 14px 16px; border-radius: 16px; box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
}
.message--mine { margin-inline-start: auto; background: rgba(13, 110, 253, 0.14); border-color: rgba(13, 110, 253, 0.35); }
.message-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; color: #8f98aa; font-size: 14px; }

.forum-lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(3, 6, 12, 0.92);
}
.forum-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.forum-lightbox-close, .forum-lightbox-nav {
  position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.forum-lightbox-close { top: 16px; inset-inline-end: 16px; }
.forum-lightbox-prev { left: 16px; top: 50%; }
.forum-lightbox-next { right: 16px; top: 50%; }

@media (max-width: 720px) {
  .forum-post { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .forum-post-author { display: flex; align-items: center; gap: 10px; }
  .forum-post-avatar { margin-bottom: 0; }
  .forum-thread-stats { align-items: flex-start; text-align: start; }
  .forum-thread-title { font-size: 19px; }
  .forum-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .forum-search .input { min-width: 0; flex: 1; }
  .message { max-width: 100%; }
}

/* Polish found in the browser check */
.header-block > .forum-thread-meta, .forum-title + .forum-thread-meta { margin-top: 14px; }
.forum-author-avatar, .forum-post-avatar, .site-nav-avatar, .forum-profile a { text-decoration: none; }
.avatar--initials { text-decoration: none; }

/* Forum personas (PLAN.md §17) */
.persona-card { display: grid; gap: 12px; padding: 16px; margin: 12px 0; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); }
.persona-card-head { display: flex; gap: 14px; align-items: center; }
.persona-avatar-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.persona-new { margin-bottom: 8px; }
.forum-postas { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.forum-postas .input { width: auto; min-width: 220px; }
.forum-postas-note { color: #a3acba; font-size: 14px; margin: 0; }

/* Footer with the language picker (PLAN.md §20.1) */
.site-footer { padding: 24px 16px 32px; text-align: center; color: #8b93a1; }
.language-picker { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.language-picker select { width: auto; max-width: 100%; }

/* Right-to-left languages (ar, he): numbers and ranges such as "30-27 C" keep their own order inside a badge. */
.badge, .fact-value { unicode-bidi: plaintext; }
