/* PNWU Virtual Microscopy — brand stylesheet */

:root {
  --navy: #1b3764;
  --lime: #99ca3c;
  --green-med: #659a41;
  --forest: #366732;
  --steel: #337ea1;
  --ink: #1f2a3d;
  --muted: #5a6675;
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --border: #dde3ea;
  --font: "Roboto", system-ui, -apple-system, sans-serif;
  --font-cond: "Roboto Condensed", var(--font);
}

* { box-sizing: border-box; }

body.page {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 1rem 1.5rem;
  border-bottom: 4px solid var(--lime);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 1200px;
  margin: 0 auto;
}
.brand img { height: 48px; width: auto; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: var(--font-cond);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-tagline {
  font-family: var(--font-cond);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--lime);
}
.auth-nav {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
  font-size: 0.9rem;
  white-space: nowrap;
}
.auth-user { color: rgb(255 255 255 / 0.85); }
.auth-link { color: var(--lime); text-decoration: none; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}
h2 {
  font-family: var(--font-cond);
  color: var(--navy);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--lime);
  display: inline-block;
  padding-bottom: 0.15rem;
  margin: 1.6rem 0 1rem;
}

/* ---------- Search panel ---------- */
.search-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgb(27 55 100 / 0.08);
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 160px; }
.field.grow { flex: 1 1 260px; }
.field > span,
.field > .field-label {
  font-family: var(--font-cond);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}
.field input,
.field select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.field input:focus-visible,
.field select:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--steel);
  outline-offset: 1px;
}

.field-reset { justify-content: flex-end; }
.btn-reset { background: var(--steel); }
.btn-reset:hover { background: var(--navy); }

/* ---------- Filter pills ---------- */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 220px;
}
.pills:empty { display: none; }
.pill {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.pill:hover { background: var(--steel); }
.pill .pill-x { color: var(--lime); font-weight: 700; }

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  border-color: var(--green-med);
  box-shadow: 0 4px 14px rgb(27 55 100 / 0.16);
  transform: translateY(-2px);
}
.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #0b0c0e;
  display: block;
}
.card.no-thumb::before {
  content: "";
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--navy), var(--steel));
}
.card-title {
  font-family: var(--font-cond);
  font-weight: 700;
  padding: 0.6rem 0.75rem 0.15rem;
  color: var(--navy);
  overflow-wrap: anywhere;
}
.card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 0.75rem 0.6rem;
}
.card-title:last-child { padding-bottom: 0.6rem; }
.results-note { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); grid-column: 1 / -1; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: rgb(255 255 255 / 0.75);
  font-size: 0.82rem;
  text-align: center;
  padding: 0.9rem;
  margin-top: 2rem;
}

/* ---------- Viewer page ---------- */
body.viewer-body {
  margin: 0;
  background: #000;
  font-family: var(--font);
}
#map {
  position: fixed;
  inset: 0;
  background: #000;
}
.viewer-chip {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: rgb(27 55 100 / 0.88);
  color: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-size: 0.88rem;
  max-width: min(70vw, 560px);
  flex-wrap: wrap;
}
.viewer-chip strong { font-family: var(--font-cond); font-size: 1rem; }
.viewer-chip span { color: rgb(255 255 255 / 0.85); }

.viewer-toast {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgb(27 55 100 / 0.88);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  opacity: 1;
  transition: opacity 0.3s ease;
}
a.viewer-toast:hover { text-decoration: underline; }
.viewer-toast-out { opacity: 0; }

/* ---------- Not found ---------- */
.notfound { max-width: 480px; margin: 12vh auto; text-align: center; font-family: var(--font); }
.notfound h1 { color: var(--navy); font-family: var(--font-cond); }
.notfound a { color: var(--steel); }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.admin-login {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.admin-login h1 { font-family: var(--font-cond); color: var(--navy); margin: 0; font-size: 1.3rem; }
.error-msg { color: #a2262d; font-size: 0.9rem; margin: 0; }
.btn {
  font: inherit;
  font-weight: 500;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}
.btn:hover { background: var(--steel); }
.btn-accent { background: var(--green-med); }
.btn-accent:hover { background: var(--forest); }
.btn-danger { background: #a2262d; }
.btn-danger:hover { background: #7d1e24; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--card-bg); font-size: 0.9rem; }
.admin-table th {
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  background: var(--navy);
  color: #fff;
  padding: 0.55rem 0.7rem;
  position: sticky;
  top: 0;
}
.admin-table td { border-bottom: 1px solid var(--border); padding: 0.35rem 0.5rem; }
.admin-table input {
  font: inherit;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.admin-table tr.dirty input { border-color: var(--steel); background: #eef6fb; }
.admin-table tr.saved input { border-color: var(--green-med); }
.admin-table .row-status { font-size: 0.8rem; width: 4.5rem; color: var(--muted); }
.admin-bar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.admin-bar input[type="search"] {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  flex: 1 1 220px;
}
.pager { display: flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; }
.pager a {
  color: var(--steel);
  text-decoration: none;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.pager a[aria-current="page"] { background: var(--navy); color: #fff; border-color: var(--navy); }

@media (max-width: 640px) {
  .brand img { height: 36px; }
  .brand-name { font-size: 1.1rem; }
  .container { padding: 1rem; }
  .viewer-chip { top: auto; bottom: 12px; right: 12px; left: 12px; max-width: none; }
}
