/* Marci MS 408A photography package — portal styling.
   Follows the QuantumLynx Research / Marci Letter interactive map look. */

:root {
  --bg-dark: #0c0e0c;
  --bg-dark-2: #1c1917;
  --text-light: #f5f5f4;
  --text-light-2: #e7e5e4;
  --accent-sky: #0284c7;
  --accent-sky-bright: #38bdf8;
  --parchment-1: #f4ecdb;
  --parchment-2: #e6d9bd;
  --parchment-ink: #2c2013;
  --sepia: #8a6d3b;
  --sepia-dark: #6b5227;
  --border-brown: #7c6a52;
  --panel-bg: #faf5e8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-dark-2);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-dark);
  padding: 0.75rem 1.5rem;
  font-family: "Kanit", "Trebuchet MS", sans-serif;
  font-weight: 300;
}
@media (min-width: 640px) {
  .navbar { flex-direction: row; align-items: center; padding: 0.75rem 3rem; }
}
.navbar-brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.navbar-logo { display: inline-block; width: 3rem; height: 3rem; color: #f5f5f4; }
.navbar-logo svg { width: 100%; height: 100%; display: block; }
.navbar-wordmark { font-size: 1.5rem; color: var(--text-light-2); }
.brand-wordmark { font-family: "Times New Roman", Times, serif; }
.brand-wordmark sup { font-size: 0.5em; }
.navbar-nav { display: flex; align-items: center; gap: 1.5rem; font-size: 1.05rem; color: #fafaf9; flex-wrap: wrap; }
.navbar-nav a { color: inherit; text-decoration: none; }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--accent-sky-bright); }
.navbar-user-anchor { position: relative; }
.navbar-user-byline { position: absolute; top: 100%; left: 0; white-space: nowrap; font-size: 0.8rem; font-style: italic; color: #a8a29e; }
.navbar--with-byline { padding-bottom: 1.75rem; }

/* Sub-header banner for this mini-app's own internal pages (Overview /
   Full inventory / Inventory CSV) - kept separate from the main site
   navbar above it, which now matches every other page on the site
   (same as the interactive Marci Letter map mini-app), rather than
   being replaced by these three links. */
.session-subnav {
  background: var(--parchment-2);
  border-bottom: 1px solid var(--border-brown);
  padding: 0.6rem 1.5rem;
}
.session-subnav-nav {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}
.session-subnav-nav a {
  color: var(--sepia-dark);
  text-decoration: none;
  font-weight: 500;
}
.session-subnav-nav a:hover,
.session-subnav-nav a.active {
  color: var(--sepia);
  text-decoration: underline;
}

/* ---------- Main ---------- */
.app-main {
  flex: 1;
  padding: 1.75rem 1.5rem 3rem;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(20,14,6,0.35) 100%),
    linear-gradient(160deg, var(--parchment-1), var(--parchment-2));
  color: var(--parchment-ink);
}
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }

/* This mini-app is "By Invite" access-gated (see routes_marci_beinecke.py) -
   matches the .private-banner/.private-badge treatment used on the main
   site and on the interactive Marci Letter map. */
.private-badge {
  align-self: center;
  background: #dc2626;
  color: #ffffff;
  padding: 0.4rem 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 0.25rem;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

.page-title {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--sepia-dark);
  text-align: center;
  text-wrap: balance;
}
.page-sub {
  margin: 0; text-align: center; font-style: italic;
  font-family: Georgia, "Iowan Old Style", serif; color: var(--sepia);
}

.manuscript-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-brown);
  border-radius: 6px;
  box-shadow: 0 3px 14px rgba(40, 28, 10, 0.25), inset 0 0 0 4px #fffdf6;
  position: relative;
  padding: 1.4rem 1.6rem;
}
.manuscript-panel::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(138, 109, 59, 0.55);
  border-radius: 3px; pointer-events: none;
}
.corner-flourish { position: absolute; width: 14px; height: 14px; border: 2px solid var(--sepia); pointer-events: none; }
.corner-flourish.tl { top: 3px; left: 3px; border-right: none; border-bottom: none; }
.corner-flourish.tr { top: 3px; right: 3px; border-left: none; border-bottom: none; }
.corner-flourish.bl { bottom: 3px; left: 3px; border-right: none; border-top: none; }
.corner-flourish.br { bottom: 3px; right: 3px; border-left: none; border-top: none; }

.manuscript-panel h2 {
  margin: 0 0 0.6rem;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 1.35rem; color: var(--sepia-dark);
}
.manuscript-panel h3 {
  margin: 1.1rem 0 0.35rem;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 1.05rem; color: var(--sepia-dark);
}
.manuscript-panel p { margin: 0 0 0.7rem; line-height: 1.6; }
.manuscript-panel p:last-child { margin-bottom: 0; }
code { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.86em;
  background: #f0e7d3; border: 1px solid #ded0b2; border-radius: 3px; padding: 0 4px; }

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; }
.stat {
  background: var(--panel-bg); border: 1px solid var(--border-brown); border-radius: 5px;
  padding: 0.7rem 0.9rem; text-align: center;
  box-shadow: 0 2px 8px rgba(40,28,10,.18);
}
.stat .n { display: block; font-size: 1.7rem; font-weight: 700; color: var(--sepia-dark);
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .l { display: block; font-size: 0.72rem; letter-spacing: .08em; text-transform: uppercase; color: #6f5f45; }

/* ---------- Contents table ---------- */
.contents { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.contents th { text-align: left; font-size: 0.72rem; letter-spacing: .08em; text-transform: uppercase;
  color: #6f5f45; font-weight: 700; padding: 0.4rem 0.6rem; border-bottom: 1px solid #ded0b2; }
.contents td { padding: 0.42rem 0.6rem; border-bottom: 1px solid #ece1c9; vertical-align: top; }
.contents tr:last-child td { border-bottom: none; }
.contents td:first-child { font-family: "SFMono-Regular", Menlo, Consolas, monospace; white-space: nowrap; }

/* ---------- Sheet browser ---------- */
.sheet-bar { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.sheet-bar label { font-size: 0.85rem; color: #6f5f45; letter-spacing: .04em; text-transform: uppercase; }
select, .btn {
  font: inherit; font-size: 0.92rem;
  background: linear-gradient(180deg, #fffdf6, #efe4cc);
  border: 1px solid var(--border-brown); border-radius: 4px;
  color: var(--parchment-ink); padding: 0.35rem 0.7rem; cursor: pointer;
}
.btn:hover, select:hover { border-color: var(--sepia-dark); }
.btn.primary { background: linear-gradient(180deg, #0369a1, #0284c7); color: #fff; border-color: #075985; }
.sheet-count { margin-left: auto; font-size: 0.85rem; color: #6f5f45; }

.sheet-stage { position: relative; line-height: 0; }
.sheet-stage img { width: 100%; height: auto; display: block; border-radius: 3px; }
.hot {
  position: absolute; display: block; border: 2px solid transparent; border-radius: 3px;
  transition: border-color .12s, background-color .12s;
}
.hot:hover, .hot:focus-visible {
  border-color: var(--accent-sky-bright);
  background: rgba(56, 189, 248, 0.13);
  outline: none;
}

/* ---------- Inventory table ---------- */
.inv-tools { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.inv-tools input[type=search] {
  font: inherit; font-size: 0.92rem; padding: 0.35rem 0.7rem; min-width: 15rem;
  border: 1px solid var(--border-brown); border-radius: 4px; background: #fffdf6; color: var(--parchment-ink);
}
.tablescroll { overflow-x: auto; }
table.inv { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.inv th {
  position: sticky; top: 0; z-index: 2;
  background: #f2e8d2; text-align: left; font-size: 0.68rem; letter-spacing: .07em;
  text-transform: uppercase; color: #6f5f45; font-weight: 700;
  padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border-brown); white-space: nowrap; cursor: pointer;
}
table.inv td { padding: 0.34rem 0.6rem; border-bottom: 1px solid #ece1c9; white-space: nowrap; }
table.inv td.subject { white-space: normal; min-width: 16rem; }
table.inv tr.clickable { cursor: pointer; }
table.inv tr.clickable:hover td { background: rgba(56, 189, 248, 0.14); }
.mono { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 0.68rem; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 10px; border: 1px solid; }
.pill.usable      { color: #1d5c40; border-color: #79a690; background: #e3efe8; }
.pill.calibration { color: #7a5a12; border-color: #c6a95f; background: #f4ecd6; }
.pill.discard     { color: #7d2f2b; border-color: #c08b87; background: #f5e3e1; }
.pill.duplicate   { color: #5c5346; border-color: #bdb0a0; background: #efeae0; }
.pill.amb         { color: #275172; border-color: #8aa9c4; background: #e4edf5; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; background: rgba(12,14,12,.94); display: none;
  z-index: 100; flex-direction: column; }
.lb.open { display: flex; }
.lb-head { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.1rem;
  background: var(--bg-dark); color: var(--text-light-2); flex-wrap: wrap; }
.lb-title { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92rem; }
.lb-meta { font-size: 0.82rem; color: #a8a29e; }
.lb-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.lb-body { flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 1rem; }
.lb-body img { max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 6px 32px rgba(0,0,0,.6); background: #201c18; }
.lb-body.rot { overflow: hidden; }
img.r-90  { transform: rotate(-90deg); }
img.r0    { transform: none; }
.lb-nav { background: none; border: 1px solid #57534e; color: var(--text-light-2);
  border-radius: 4px; padding: 0.3rem 0.7rem; cursor: pointer; font: inherit; font-size: 0.9rem; }
.lb-nav:hover { border-color: var(--accent-sky-bright); color: var(--accent-sky-bright); }
.lb a.dl { color: var(--accent-sky-bright); text-decoration: none; font-size: 0.9rem; }
.lb a.dl:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-dark); color: var(--text-light-2); text-align: center;
  padding: 1.1rem 1rem; font-size: 0.82rem; border-top: 3px solid var(--sepia-dark);
}
.site-footer p { margin: 0.2rem 0; }
.site-footer .credit { font-size: 0.72rem; font-style: italic; margin-top: 0.5rem;
  max-width: 68ch; margin-left: auto; margin-right: auto; line-height: 1.5; }
.site-footer a { color: var(--accent-sky-bright); }

@media (max-width: 700px) {
  .app-main { padding: 1.2rem 0.8rem 2rem; }
  .manuscript-panel { padding: 1.1rem 0.9rem; }
}

/* ---------- Setup photograph ---------- */
.setup-figure { margin: 1.2rem 0 0.4rem; max-width: 320px; }
.setup-figure img {
  width: 100%; height: auto; display: block; border-radius: 4px;
  border: 1px solid var(--border-brown);
  box-shadow: 0 3px 14px rgba(40, 28, 10, 0.3);
}
.setup-figure figcaption {
  margin-top: 0.55rem; font-size: 0.86rem; line-height: 1.55;
  font-style: italic; color: #6f5f45; max-width: 62ch;
}
