/* Mosaic 1999 - version 2 of the ncsa-mosaic look.
   shadcn/ui's component vocabulary in the NCSA Mosaic / Motif look: square
   corners, Times, period link colors, gray bevel chrome, flat tables.
   Plain CSS, no build. Class names follow shadcn/Basecoat where they exist.
   Apps can lower the type with --font-size (the default is 16pt). */

:root {
  --radius: 0;

  --background: #ffffff;
  --foreground: #000000;
  --card: #ffffff;
  --card-foreground: #000000;
  --muted: #e8e8e8;
  --muted-foreground: #404040;
  --primary: #0000ee;
  --primary-foreground: #ffffff;
  --secondary: #c0c0c0;
  --secondary-foreground: #000000;
  --accent: #fff3a8;
  --destructive: #cc0000;
  --destructive-tint: #ffd6d6;
  --warning: #b36b00;
  --warning-tint: #ffe9b3;
  --success: #006400;
  --border: #000000;
  --input: #ffffff;
  --ring: #000000;

  --link: #0000ee;
  --link-visited: #551a8b;
  --link-active: #ee0000;
  --mark: #e8c547;
  --note: #ffffcc;

  /* Motif chrome */
  --chrome: #c0c0c0;
  --bevel-hi: #ffffff;
  --bevel-mid: #dfdfdf;
  --bevel-lo: #808080;
  --bevel-dk: #404040;

  /* chart series: hero blue, then the 16-color web palette */
  --chart-1: #0000ee;
  --chart-2: #800000;
  --chart-3: #808000;
  --chart-4: #800080;
  --chart-5: #008080;
  --chart-muted: #808080;

  --font-serif: "Times New Roman", Times, serif;
  --font-ui: Helvetica, Arial, sans-serif;
  --font-mono: "Courier New", Courier, monospace;
}

:root[data-theme="dark"] {
  --background: #1c1c1c;
  --foreground: #e8e8e8;
  --card: #262626;
  --card-foreground: #e8e8e8;
  --muted: #333333;
  --muted-foreground: #b0b0b0;
  --primary: #8fa8ff;
  --primary-foreground: #000000;
  --secondary: #4a4a4a;
  --secondary-foreground: #e8e8e8;
  --accent: #5c5320;
  --destructive-tint: #5a2626;
  --warning: #e0a040;
  --warning-tint: #4d3a14;
  --success: #6bd66b;
  --border: #9a9a9a;
  --input: #141414;
  --ring: #e8e8e8;
  --link: #8fa8ff;
  --link-visited: #c49bff;
  --note: #3a3620;
  --chrome: #4a4a4a;
  --bevel-hi: #7a7a7a;
  --bevel-mid: #5a5a5a;
  --bevel-lo: #2a2a2a;
  --bevel-dk: #000000;
  --chart-1: #8fa8ff;
  --chart-2: #ff8f8f;
  --chart-3: #d6d66b;
  --chart-4: #e19be1;
  --chart-5: #6bd6d6;
  --chart-muted: #8a8a8a;
}

* { box-sizing: border-box; border-radius: var(--radius) !important; }

html { background: var(--background); color: var(--foreground); }
body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--font-size, 16pt);
  line-height: 1.5;
  background: var(--background);
  color: var(--foreground);
}

a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:active { color: var(--link-active); }
mark { background: var(--mark); color: #000; padding: 0 .1em; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: bold; line-height: 1.2; }
h1 { font-size: 2.1em; margin: .2em 0 .3em; }
h2 { font-size: 1.55em; margin: 1.6em 0 .5em; }
h3 { font-size: 1.2em; margin: 1.3em 0 .4em; }

code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
pre { background: var(--muted); border: 1px solid var(--border); padding: .6em .8em; overflow-x: auto; }

blockquote { margin: 1em 0; padding: .1em 1em; border-left: 4px double var(--border); }

/* separator */
hr, .separator { border: 0; border-top: 3px double var(--border); margin: 1.6em 0; }

/* ---------- button: Motif bevel ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--font-ui); font-size: 13px; font-weight: bold;
  color: var(--secondary-foreground); text-decoration: none;
  background: var(--chrome);
  padding: .35em .9em;
  border: 2px solid; border-color: var(--bevel-hi) var(--bevel-dk) var(--bevel-dk) var(--bevel-hi);
  box-shadow: inset -1px -1px var(--bevel-lo), inset 1px 1px var(--bevel-mid);
  cursor: pointer;
}
a.btn:visited { color: var(--secondary-foreground); }
.btn:active, .btn[aria-pressed="true"] {
  border-color: var(--bevel-dk) var(--bevel-hi) var(--bevel-hi) var(--bevel-dk);
  box-shadow: inset 1px 1px var(--bevel-lo), inset -1px -1px var(--bevel-mid);
  padding: calc(.35em + 1px) calc(.9em - 1px) calc(.35em - 1px) calc(.9em + 1px);
}
.btn:focus-visible { outline: 1px dotted var(--ring); outline-offset: -5px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
a.btn-primary:visited { color: var(--primary-foreground); }
.btn-sm { font-size: 11px; padding: .2em .6em; }

/* ---------- input: sunken ---------- */
.input, select.input, textarea.input {
  font-family: var(--font-mono); font-size: 15px;
  background: var(--input); color: var(--foreground);
  padding: .3em .45em;
  border: 2px solid; border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
  box-shadow: inset 1px 1px var(--bevel-dk);
}
.input:focus { outline: 1px dotted var(--ring); outline-offset: 2px; }

/* ---------- badge ---------- */
.badge {
  display: inline-block;
  font-family: var(--font-ui); font-size: 11px; font-weight: bold;
  letter-spacing: .03em; text-transform: uppercase;
  padding: .15em .5em; line-height: 1.3;
  border: 1px solid var(--border);
  background: var(--chrome); color: var(--secondary-foreground);
  vertical-align: middle;
}
.badge-primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.badge-outline { background: transparent; color: var(--foreground); }
.badge-destructive { background: var(--destructive); color: #fff; border-color: var(--destructive); }
.badge-accent { background: var(--mark); color: #000; }

/* ---------- card ---------- */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border);
  margin: 1.2em 0;
}
.card > header {
  display: flex; align-items: center; gap: .6em; flex-wrap: wrap;
  padding: .3em .7em;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui); font-size: 12px; font-weight: bold;
}
.card > header .card-label { margin-right: auto; }
.card > section { padding: .8em 1em; }
.card > footer {
  padding: .5em 1em .7em;
  border-top: 1px solid var(--border);
  font-size: .75em; color: var(--muted-foreground);
}
.card-title { font-size: 1.15em; font-weight: bold; margin: 0; }
.card-description { margin: .1em 0 0; color: var(--muted-foreground); font-style: italic; }

/* ---------- alert ---------- */
.alert {
  border: 1px solid var(--border);
  border-left: 6px solid var(--border);
  background: var(--note);
  padding: .6em .9em;
  margin: 1em 0;
}
.alert-title {
  font-family: var(--font-ui); font-size: 12px; font-weight: bold;
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .2em;
}
.alert-destructive { border-left-color: var(--destructive); }
.alert-destructive .alert-title { color: var(--destructive); }
.alert-primary { border-left-color: var(--primary); background: var(--card); }
.alert p { margin: .2em 0; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--border); }
table { border-collapse: collapse; width: 100%; font-size: .82em; font-variant-numeric: tabular-nums; }
th, td { border: 1px solid var(--bevel-lo); padding: .3em .55em; text-align: left; vertical-align: top; }
th { background: var(--chrome); font-family: var(--font-ui); font-size: .85em; }
tbody tr:nth-child(even) td { background: var(--muted); }

/* ---------- key/value list ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25em 1em; margin: 0; }
.kv dt { font-family: var(--font-ui); font-size: 12px; font-weight: bold; padding-top: .3em; text-transform: uppercase; letter-spacing: .03em; }
.kv dd { margin: 0; }

/* ---------- breadcrumb ---------- */
.breadcrumb { font-family: var(--font-ui); font-size: 12px; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .4em; }
.breadcrumb li + li::before { content: "/"; margin-right: .4em; color: var(--muted-foreground); }

/* ---------- sidebar nav ---------- */
.nav { list-style: none; margin: 0; padding: 0; font-size: .82em; }
.nav li { border-bottom: 1px dotted var(--bevel-lo); }
.nav li:last-child { border-bottom: 0; }
.nav a { display: block; padding: .25em 0; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; }

/* ---------- chart ---------- */
.chart svg { display: block; width: 100%; height: auto; }
.chart svg text { font-family: var(--font-serif); fill: var(--foreground); }
.chart .legend { display: flex; flex-wrap: wrap; gap: .3em 1.2em; font-size: .8em; margin: .2em 0 .4em; }
.chart .swatch { display: inline-block; width: .8em; height: .8em; border: 1px solid var(--border); margin-right: .35em; vertical-align: -.05em; }
.chart figure, figure.chart { margin: 0; }
.figure-img img { display: block; width: 100%; height: auto; }

/* ---------- kbd ---------- */
kbd, .kbd {
  display: inline-block; min-width: 1.6em; text-align: center;
  font-family: var(--font-ui); font-size: 11px; font-weight: bold; line-height: 1.4;
  padding: 0 .35em;
  background: var(--chrome); color: var(--secondary-foreground);
  border: 1px solid; border-color: var(--bevel-hi) var(--bevel-dk) var(--bevel-dk) var(--bevel-hi);
  box-shadow: 1px 1px 0 var(--bevel-lo);
}

/* ---------- figure ---------- */
figure { margin: 1em 0; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
figcaption { font-size: .8em; font-style: italic; color: var(--muted-foreground); margin-top: .3em; }

.figure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8em; margin: 1em 0; }
.figure-grid figure { margin: 0; }
.figure-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; }

/* ---------- lightbox: toggle [hidden]; close on Escape or click in page JS ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em;
  padding: 16px;
  background: rgba(0, 0, 0, .88);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 6em); border: 2px solid #fff; background: #fff; }
.lightbox figcaption, .lightbox .lightbox-caption { color: #fff; font-style: italic; }

/* ---------- image pane: scroll container, click-to-zoom ---------- */
.image-pane {
  overflow: auto; max-height: 80vh;
  background: var(--muted);
  border: 2px solid; border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
}
.image-pane img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.image-pane.zoomed img { width: 200%; max-width: none; cursor: zoom-out; }

/* ---------- marker strip: status swatches, current item outlined ---------- */
.marker-strip { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--chrome); border: 1px solid var(--border); }
.marker {
  width: 14px; height: 14px; padding: 0;
  border: 1px solid var(--border);
  background: var(--card); cursor: pointer;
}
.marker[data-status="high"] { background: var(--success); }
.marker[data-status="medium"] { background: var(--warning); }
.marker[data-status="low"] { background: var(--destructive); }
.marker[data-status="blank"] { background: var(--card); }
.marker[data-status="flagged"] { background: var(--primary); }
.marker[aria-current="true"], .marker.current { outline: 2px solid var(--foreground); outline-offset: 1px; }
.marker:focus-visible { outline: 1px dotted var(--ring); outline-offset: 2px; }

/* ---------- OCR marks ---------- */
.mark-illegible { background: var(--destructive-tint); color: var(--foreground); border-bottom: 1px solid var(--destructive); padding: 0 .15em; }
.mark-uncertain { background: var(--warning-tint); color: var(--foreground); border-bottom: 1px dashed var(--warning); padding: 0 .15em; }
.mark-drawing { font-style: italic; color: var(--muted-foreground); }

.badge-success { background: var(--success); color: #fff; border-color: var(--success); }
.badge-warning { background: var(--warning); color: #fff; border-color: var(--warning); }

/* ---------- burger: the Enclave menu, as a component ---------- */
.burger { position: fixed; top: .5rem; right: .5rem; z-index: 900; font-size: 16px; line-height: 1.4; }
.burger > summary {
  list-style: none; cursor: pointer; display: block;
  width: 1.8em; height: 1.8em; padding: 0;
  border: 1px solid var(--border); background: var(--card);
  font-size: 1.25em; line-height: 1.7em; text-align: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.burger > summary::-webkit-details-marker { display: none; }
.burger > summary::marker { content: ""; }
.burger[open] > summary { background: var(--muted); border-style: inset; }
.burger nav {
  position: absolute; right: 0; top: calc(100% + .3em);
  background: var(--card); border: 1px solid var(--border);
  padding: .5em .9em; min-width: 13em; max-height: 80vh; overflow-y: auto;
}
.burger ul { list-style: none; margin: 0; padding: 0; }
.burger li { margin: .25em 0; white-space: nowrap; }
.burger hr { margin: .45em 0; border: 0; border-top: 1px solid var(--bevel-lo); }
.burger button.linklike { font: inherit; color: var(--link); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
@media print { .burger { display: none; } }
