/*
  Field Notes site styles — dark variant
  ======================================

  Dark theme adaptation of the main site stylesheet.
  This file keeps the same component structure as site-dark.css but swaps the
  colour system and a handful of base surfaces for dark-mode testing.
*/

/* =========================================================
   1. Design tokens
   ========================================================= */

:root {
  --content-max-width: 980px;

  /* Dark palette */
  --color-page-bg: #0b1220;
  --color-page-bg-soft: #111827;
  --color-border: #243042;
  --color-border-strong: #334155;
  --color-surface: #111827;
  --color-surface-elevated: #162032;
  --color-row-stripe: #0f172a;
  --color-row-hover: #172235;
  --color-text: #e5e7eb;
  --color-text-muted: #9ca3af;
  --color-text-muted-strong: #cbd5e1;
  --color-text-subtle: #94a3b8;
  --color-separator: #64748b;
  --color-link: #7cc4ff;
  --color-link-hover: #a5d8ff;
  --color-button: #2563eb;
  --color-button-hover: #1d4ed8;
  --color-white: #f8fafc;

  --line-height-body: 1.6;
  --font-size-small: 0.9rem;
  --font-size-meta: 0.95rem;

  --space-1: 0.4rem;
  --space-2: 0.6rem;
  --space-3: 0.8rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;

  --radius-soft: 6px;
  --radius-card: 8px;
}

/* =========================================================
   2. Base layout and typography
   ========================================================= */

.site-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

html,
body {
  background: var(--color-page-bg);
  color: var(--color-text);
  color-scheme: dark;
}

main {
  overflow-x: auto;
  line-height: 1.65;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem;
}

main p {
  margin-bottom: 1.1rem;
}

body {
  line-height: var(--line-height-body);
}

img {
  max-width: 100%;
  height: auto;
}

main {
  line-height: 1.65;
  max-width: 70ch;
}

main p {
  margin-bottom: 1.1rem;
}

/* =========================================================
   3. Link treatment and helper text
   ========================================================= */

a {
  color: var(--color-link);
}

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

.muted {
  color: var(--color-text-muted);
  font-size: var(--font-size-meta);
}

/* =========================================================
   4. Shared table system
   ========================================================= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-meta);
  background: transparent;
}

table th,
table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}

table thead th {
  color: var(--color-text-muted-strong);
}

table tbody tr:hover td {
  background: var(--color-row-hover);
}

table.data-table {
  table-layout: auto;
}

table.data-table th,
table.data-table td {
  white-space: nowrap;
}

table.data-table tbody tr:nth-child(odd) td {
  background: var(--color-row-stripe);
}

table.data-table.cols-4 th:nth-child(1),
table.data-table.cols-4 td:nth-child(1) {
  width: 22%;
}

table.data-table.cols-4 th:nth-child(2),
table.data-table.cols-4 td:nth-child(2) {
  width: 22%;
}

table.data-table.cols-4 th:nth-child(3),
table.data-table.cols-4 td:nth-child(3) {
  width: 28%;
}

table.data-table.cols-4 th:nth-child(4),
table.data-table.cols-4 td:nth-child(4) {
  width: 28%;
}

table.data-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.04);
}

table.data-table thead th {
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 2;
  box-shadow: 0 2px 0 rgba(255,255,255,0.12);
  border-bottom: 2px solid rgba(255,255,255,0.12);
}

table.data-table tbody tr:hover {
  background: rgba(255,255,255,0.08);
}

table.data-table thead {
  background: rgba(255,255,255,0.05);
}

/* =========================================================
   5. Breadcrumb navigation
   ========================================================= */

.breadcrumbs {
  margin: 0.75em 0;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs ol {
  display: inline;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  display: inline;
}

.breadcrumbs li + li::before {
  content: " > ";
  color: var(--color-separator);
}

.breadcrumbs a {
  color: var(--color-link);
  text-decoration: none;
}

.breadcrumbs li:not(:last-child) a {
  opacity: 0.9;
}

.breadcrumbs span {
  color: var(--color-text-muted-strong);
}

/* =========================================================
   6. Microscopy-specific components
   ========================================================= */

.plate-row,
#plates-table {
  display: none;
}

#series-filter {
  margin-bottom: var(--space-4);
  background: var(--color-surface-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-soft);
  padding: 0.45rem 0.55rem;
}

.image-mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: var(--space-6) 0;
}

.image-mosaic a {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
}

.image-mosaic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image1 {
  grid-column: span 2;
  grid-row: span 2;
}

.image2 {
  grid-column: span 2;
  grid-row: span 1;
}

.image3,
.image4 {
  grid-column: span 1;
  grid-row: span 1;
}

/* =========================================================
   7. Shared figure / report viewer components
   ========================================================= */

.report-figure {
  max-width: var(--content-max-width);
  margin: var(--space-7) auto;
  padding: var(--space-5) var(--space-5) var(--space-6);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-card);
  background: linear-gradient(
    180deg,
    rgba(22, 32, 50, 0.96) 0%,
    rgba(17, 24, 39, 0.98) 100%
  );
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.report-image-wrap {
  text-align: center;
}

.report-image-wrap img {
  display: block;
  margin: 0 auto;
}

.report-image-wrap video {
  width: 100%;
  height: auto;
  display: block;
}

.report-caption {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.95em;
  color: var(--color-text-muted);
}

.download-block {
  margin-top: var(--space-5);
  text-align: center;
}

.download-btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--color-button);
  border-radius: var(--radius-soft);
  background: var(--color-button);
  color: var(--color-white);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}

.download-btn:hover,
.download-btn:focus {
  border-color: var(--color-button-hover);
  background: var(--color-button-hover);
  color: var(--color-white);
  text-decoration: none;
}

.download-note {
  margin-top: var(--space-2);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

/* =========================================================
   8. Footer
   ========================================================= */

.site-footer {
  margin-top: var(--space-7);
  padding: 1.4rem 1.25rem 1rem;
  font-size: var(--font-size-small);

  background: #1a1d21;
  border-top: 2px solid #2b3138;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 1.5rem;
}

.footer-left {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  text-align: left;
  min-width: 0;
  flex: 1 1 32rem;
}

.footer-icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: #8fa2b5;
  opacity: 0.8;
  margin-top: 0.05rem;
}

.footer-main {
  min-width: 0;
}

.footer-line {
  line-height: 1.45;
}

.footer-line-primary {
  color: #d9e1ea;
}

.footer-line-secondary {
  margin-top: 0.15rem;
  font-size: 0.92em;
  color: #9aa6b2;
  letter-spacing: 0.01em;
}

.footer-owner {
  font-weight: 600;
}

.footer-right {
  color: #9aa6b2;
  text-align: right;
  flex: 0 1 22rem;
  line-height: 1.45;
}

.footer-right a {
  color: #7fb4ff;
  font-weight: 600;
  text-decoration: none;
}

.footer-right a:hover {
  text-decoration: underline;
}

.footer-feedback-label {
  margin-right: 0.25em;
}

.footer-meta {
  color: #8fa0b0;
  font-style: italic;
  white-space: nowrap;
}

.footer-sep {
  margin: 0 0.45em;
  color: #4a525c;
}

.footer-attribution {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2b3138;
  font-size: 0.85em;
  color: #8c97a3;
  text-align: center;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .site-footer {
    padding: 1.1rem 1rem 0.9rem;
  }

  .footer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-left,
  .footer-right {
    flex: 1 1 auto;
  }

  .footer-right {
    text-align: left;
  }

  .footer-meta {
    white-space: normal;
  }
}

/* =========================================================
   9. Responsive adjustments
   ========================================================= */

@media (max-width: 700px) {
  .breadcrumbs {
    white-space: normal;
  }

  .image-mosaic {
    grid-template-columns: 1fr 1fr;
  }

  .image1,
  .image2,
  .image3,
  .image4 {
    grid-column: span 1;
    grid-row: span 1;
  }

  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .footer-right {
    text-align: left;
  }

  table.data-table th,
  table.data-table td {
    white-space: normal;
  }
}

/* =========================================================
   10. Dataset citations
   ========================================================= */

.dataset-citation {
  margin-top: 2rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  font-size: 0.88em;
}

.dataset-citation h3 {
  margin: 0 0 0.4rem 0;
  font-size: 0.9em;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}

.dataset-citation-main {
  font-size: 0.88em;
}

.dataset-meta {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-size: 0.85em;
  opacity: 0.85;
}

.dataset-meta span {
  white-space: nowrap;
}

.dataset-bibtex {
  margin-top: 0.5rem;
  background: rgba(0,0,0,0.25);
  padding: 0.6rem 0.7rem;
  border-radius: 4px;
  font-size: 0.9em;
  overflow-x: auto;
}

.dataset-citation summary {
  cursor: pointer;
  margin-top: 0.3rem;
  font-size: 0.9em;
  opacity: 0.85;
}

.dataset-citation-credit {
  font-size: 0.88em;
}

.dataset-citation-entry {
  margin-bottom: 1.5rem;
}

.dataset-actions {
  margin: 0.4rem 0 0.8rem 0;
}

.copy-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: #2a2a2a;
  border-color: #666;
  color: #fff;
}

.copy-btn:active {
  transform: translateY(1px);
}

/* =========================================================
   11. Plate Library Lightbox
   ========================================================= */

.plate-card {
  display: none;
}

#plates-grid {
  display: none;
  margin-top: 1.25rem;
}

.plates-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.plate-card {
  background: #1e1e1e;
  border: 1px solid #2f2f2f;
  border-radius: 10px;
  padding: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plate-card a {
  text-decoration: none;
  color: inherit;
}

.plate-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  background: #111;
}

.plate-card-name {
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #e6e6e6;
}

.plate-card-date {
  font-size: 0.9em;
  color: var(--text-muted, #666);
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
}

.plate-card-specimen {
  font-size: 0.95rem;
  color: #b5b5b5;
}

.plate-card-subject {
  font-size: 0.9rem;
  color: #8f8f8f;
  margin-top: 0.35rem;
}

.plate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  border-color: #444;
}

#no-results {
  display: none;
  margin-top: 1rem;
  font-style: italic;
  color: #aaa;
}

select {
  background: #1e1e1e;
  color: #ddd;
  border: 1px solid #444;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
}

label {
  color: #ccc;
}

.plate-card img {
  filter: brightness(0.95) contrast(1.05);
}

.plate-note {
  font-size: 0.85em;
  color: #777;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.note-label {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  margin-right: 0.4em;
  color: #555;
}

/* =========================================================
   12. Blog
   ========================================================= */

.archive-year {
  margin-bottom: 2.5rem;
}

.archive-year h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #ccc;
}

.archive-month {
  margin-bottom: 1.5rem;
}

.archive-month h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
}

.archive-entries {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

.archive-entry {
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.archive-date {
  display: inline-block;
  min-width: 4.5rem;
  font-variant-numeric: tabular-nums;
  color: #666;
}

.archive-separator {
  color: #999;
  margin-right: 0.35rem;
}

.archive-link {
  font-weight: 600;
  text-decoration: none;
}

.archive-link:hover {
  text-decoration: underline;
}

.archive-excerpt {
  margin-left: 5.2rem;
  margin-top: 0.15rem;
  color: #555;
  font-size: 0.95rem;
}

.notebook-entry {
  max-width: 72rem;
  margin: 0 auto 3rem auto;
}

.notebook-entry-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ccc;
}

.notebook-kicker {
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.notebook-entry-header h1 {
  margin-bottom: 0.75rem;
}

.notebook-meta {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.notebook-meta-separator {
  margin: 0 0.4rem;
}

.notebook-entry-summary {
  margin-top: 1rem;
  font-style: italic;
  color: var(--color-text-muted);
}

.notebook-entry-body {
  line-height: 1.75;
}

.notebook-entry-body h2,
.notebook-entry-body h3 {
  margin-top: 2rem;
}

.notebook-entry-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
}

.notebook-entry-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid #ccc;
  font-size: 0.95rem;
}