/* =========================================================================
   Ova Scope design tokens
   Palette: cool sage paper + slate ink + microscope teal + ochre accent
   Type: IBM Plex Mono (display/labels) + IBM Plex Sans (body)
   Signature: circular "reticle" viewport motif around specimen imagery
   ========================================================================= */

:root {
  --paper: #e9ede7;
  --panel: #f6f8f4;
  --ink: #1b2523;
  --ink-soft: #4a544f;
  --line: #c7d0c4;
  --teal: #2f6b63;
  --teal-dark: #1f4a44;
  --teal-pale: #dce9e5;
  --rust: #b5651d;
  --rust-pale: #f3e2cf;
  --danger: #a3341f;
  --danger-pale: #f5ded8;
  --radius: 3px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--teal-dark); }

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em 0;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal-dark);
  display: block;
  margin-bottom: 0.6em;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark { color: var(--teal); display: flex; }

.brand-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand-name-thin { font-weight: 400; color: var(--ink-soft); }

.site-nav { display: flex; align-items: center; gap: 1.4rem; }

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-family: var(--mono);
}

.site-nav a:hover { color: var(--teal-dark); }

.nav-cta {
  background: var(--teal);
  color: #fff !important;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
}

.nav-cta:hover { background: var(--teal-dark); }

.nav-user { font-family: var(--mono); font-size: 0.9rem; color: var(--ink); }

.tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  background: var(--rust-pale);
  color: var(--rust);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  text-transform: uppercase;
}

/* ---------- Main / layout ---------- */

.site-main { flex: 1; padding: 2.5rem 2rem 3rem; max-width: 1080px; margin: 0 auto; width: 100%; }

.site-footer {
  text-align: center;
  padding: 1.2rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* ---------- Flash messages ---------- */

.flash-stack { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.6rem; }

.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}

.flash-success { background: var(--teal-pale); border-color: var(--teal); color: var(--teal-dark); }
.flash-error { background: var(--danger-pale); border-color: var(--danger); color: var(--danger); }

/* ---------- Reticle signature motif ---------- */

.reticle {
  position: relative;
  border-radius: 50%;
  border: 1.5px dashed var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: var(--teal);
  opacity: 0.55;
  z-index: 2;
}

.reticle::before { width: 100%; height: 1px; left: 0; top: 50%; }
.reticle::after { height: 100%; width: 1px; top: 0; left: 50%; }

.reticle img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Landing page ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding: 2rem 0 4rem;
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.15;
  margin-bottom: 0.7rem;
}

.hero p.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 42ch;
  margin-bottom: 1.8rem;
}

.hero-actions { display: flex; gap: 0.9rem; }

.btn {
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1.5px solid var(--teal);
  cursor: pointer;
  display: inline-block;
}

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }

.btn-ghost { background: transparent; color: var(--teal-dark); }
.btn-ghost:hover { background: var(--teal-pale); }

.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-pale); }

.btn-small { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

.hero-scope {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 340px;
  margin: 0 auto;
}

.hero-scope .reticle {
  width: 100%;
  height: 100%;
  border-width: 2px;
}

.hero-scope-count {
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--teal-dark);
  z-index: 3;
  position: relative;
}

.hero-scope-label {
  position: absolute;
  bottom: 14%;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  z-index: 3;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.feature-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.feature-card .slide-num {
  font-family: var(--mono);
  color: var(--teal);
  font-size: 0.8rem;
  display: block;
  margin-bottom: 0.6rem;
}

.feature-card h3 { font-size: 1.02rem; margin-bottom: 0.4rem; }
.feature-card p { color: var(--ink-soft); font-size: 0.92rem; margin: 0; }

.how-it-works {
  border-top: 1px solid var(--line);
  padding-top: 2.4rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.step {
  padding: 1rem 0;
  border-top: 2px solid var(--teal);
}

.step .slide-num { font-family: var(--mono); font-size: 0.78rem; color: var(--teal); }
.step h4 { font-size: 0.95rem; margin: 0.3rem 0 0.2rem; }
.step p { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }

/* ---------- Auth forms ---------- */

.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-wrap h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-wrap .lede { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 1.6rem; }

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}

.captcha-row img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: block;
}

.captcha-refresh {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--teal-dark);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.auth-submit { width: 100%; text-align: center; }

.auth-switch {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- Dashboard ---------- */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.upload-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  margin-bottom: 2.4rem;
}

.upload-panel h2 { font-size: 1.05rem; }

.upload-dropzone {
  border: 1.5px dashed var(--teal);
  border-radius: var(--radius);
  padding: 1.6rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: #fff;
}

.upload-dropzone input[type="file"] { display: block; margin: 0.7rem auto 0; }

.upload-hint { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); margin-bottom: 1rem; }

.preview-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.preview-row .reticle { width: 70px; height: 70px; }

.batch-block {
  margin-bottom: 2.2rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--line);
}

.batch-block:last-child { border-bottom: none; }

.batch-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.8rem;
}

.specimen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem;
}

.specimen-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.specimen-card .reticle {
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 0.8rem;
}

.specimen-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.specimen-name {
  font-size: 0.88rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
}

.count-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--teal-dark);
}

.count-badge span.label {
  font-weight: 400;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

details.object-list { margin-top: 0.7rem; font-size: 0.82rem; }
details.object-list summary { cursor: pointer; font-family: var(--mono); color: var(--teal-dark); font-size: 0.78rem; }
details.object-list table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
details.object-list td, details.object-list th {
  text-align: left;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* ---------- Admin ---------- */

.stat-row { display: flex; gap: 1.2rem; margin-bottom: 2rem; flex-wrap: wrap; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  flex: 1;
  min-width: 140px;
}

.stat-card .value { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; color: var(--teal-dark); }
.stat-card .label { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; color: var(--ink-soft); letter-spacing: 0.06em; }

.filter-form {
  display: flex;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.filter-form .field { margin-bottom: 0; }

.admin-section { margin-bottom: 3rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.88rem;
}

.admin-table th {
  text-align: left;
  background: var(--teal-pale);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-dark);
  padding: 0.7rem 0.8rem;
}

.admin-table td { padding: 0.6rem 0.8rem; border-top: 1px solid var(--line); vertical-align: middle; }

.admin-table tr:hover { background: rgba(47,107,99,0.04); }

.row-actions { display: flex; gap: 0.5rem; }

.thumb-link .reticle { width: 44px; height: 44px; }

.edit-form-row td { background: #fff; }

.edit-fields { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.edit-fields input[type="text"],
.edit-fields input[type="email"],
.edit-fields input[type="password"] {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.85rem;
  width: 140px;
}

.checkbox-inline { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-family: var(--mono); }

/* ---------- Error page ---------- */

.error-wrap { text-align: center; padding: 4rem 1rem; }
.error-wrap .code { font-family: var(--mono); font-size: 4rem; color: var(--teal); font-weight: 700; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .site-header { padding: 1rem; flex-wrap: wrap; gap: 0.7rem; }
  .site-main { padding: 1.6rem 1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
