/* NC Survey Archive — layout & components.
   All visual rules live here (the app.js output carries classes, not inline
   styles) so the design is editable without touching logic. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: var(--nc-navy); }
body {
  font-family: var(--nc-body);
  color: var(--nc-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--nc-cyan); text-decoration: none; }
a:hover { color: var(--nc-cyan-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #112240; border: 1px solid rgba(0,240,255,0.4); }
::-webkit-scrollbar-thumb:hover { background: var(--nc-cyan); }

@keyframes ncpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Shell ─────────────────────────────────────────────── */
.nc-app { display: flex; flex-direction: column; height: 100svh; width: 100vw; background: var(--nc-navy); overflow: hidden; }
/* Lock document scroll while the lightbox is open (mobile document-scroll). */
html.nc-noscroll, body.nc-noscroll { overflow: hidden; }
.nc-body-row { display: flex; flex: 1; min-height: 0; }

/* ── Header ────────────────────────────────────────────── */
.nc-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 30px; border-bottom: 1px solid var(--nc-line);
  background: linear-gradient(180deg, var(--nc-navy-grad), var(--nc-navy));
  flex-shrink: 0;
}
.nc-brand { display: flex; align-items: center; gap: 16px; }
.nc-brand img { height: 42px; width: auto; filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(0,240,255,0.5)); }
.nc-brand-txt { display: flex; flex-direction: column; gap: 5px; }
.nc-brand-title { font-family: var(--nc-display); font-size: 24px; letter-spacing: 0.07em; color: var(--nc-text); line-height: 1; }
.nc-brand-sub { font-family: var(--nc-mono); font-size: 11px; letter-spacing: 0.14em; color: var(--nc-muted); }
.nc-header-right { display: flex; align-items: center; gap: 26px; }
.nc-nav { display: flex; align-items: center; gap: 22px; font-family: var(--nc-body); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.nc-nav .current { color: var(--nc-cyan); border-bottom: 1px solid var(--nc-cyan); padding-bottom: 3px; }
.nc-nav a { color: var(--nc-muted); }
.nc-nav a:hover { color: var(--nc-text); }
/* Not-yet-launched nav item: visible but non-interactive placeholder. */
.nc-nav-soon { color: var(--nc-muted); opacity: 0.5; cursor: default; }
.nc-nav-soon sup { margin-left: 4px; font-family: var(--nc-mono); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--nc-cyan); opacity: 0.85; vertical-align: super; }

/* SYSTEM STATUS readout (fixed width so nav buttons never shift as it changes) */
.nc-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; width: 430px; font-size: 11px; letter-spacing: 0.1em; }
.nc-status-label { font-family: var(--nc-head); letter-spacing: 1px; white-space: nowrap; color: var(--nc-cyan); }
.nc-status-led { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--nc-green-led); box-shadow: 0 0 5px var(--nc-green-led); animation: ncpulse 2s infinite; transition: background .5s ease, box-shadow .5s ease; }
.nc-status-ping { font-family: var(--nc-mono); color: var(--nc-cyan); opacity: 0.6; white-space: nowrap; }
.nc-status.s-elevated .nc-status-label { color: var(--nc-amber); }
.nc-status.s-elevated .nc-status-led { background: var(--nc-amber); box-shadow: 0 0 5px var(--nc-amber); }
.nc-status.s-critical .nc-status-label { color: var(--nc-red); }
.nc-status.s-critical .nc-status-led { background: var(--nc-red); box-shadow: 0 0 5px var(--nc-red); }

/* ── Filter rail ───────────────────────────────────────── */
.nc-rail {
  width: var(--nc-rail-w); flex-shrink: 0; padding: 26px 20px; overflow-y: auto;
  background: var(--nc-scrim); border-right: 1px solid rgba(0,240,255,0.18);
  display: flex; flex-direction: column;
}
.nc-rail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.nc-rail-head .lbl { font-family: var(--nc-body); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--nc-muted); }
.nc-reset { font-family: var(--nc-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--nc-muted-3); background: transparent; border: none; cursor: pointer; padding: 0; text-transform: uppercase; }
.nc-reset.active { color: var(--nc-cyan); }
.nc-facets { display: flex; flex-direction: column; gap: 22px; }
.nc-facet-label {
  font-family: var(--nc-body); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--nc-muted); margin-bottom: 11px; cursor: help;
  border-bottom: 1px dotted rgba(136,146,176,0.4); padding-bottom: 6px; display: inline-block;
}
.nc-facet-opts { display: flex; flex-direction: column; gap: 7px; }
.nc-opt {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; background: transparent; color: var(--nc-muted-2);
  border: 1px solid var(--nc-line-btn); cursor: pointer;
  font-family: var(--nc-body); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  transition: all 150ms ease; text-align: left;
}
.nc-opt:hover { border-color: rgba(0,240,255,0.5); }
.nc-opt.child { padding-left: 28px; color: var(--nc-muted-4); }
.nc-opt.on { background: var(--nc-cyan); color: var(--nc-navy); border-color: var(--nc-cyan); }
.nc-opt.disabled { opacity: 0.35; cursor: default; }
.nc-opt.disabled:hover { border-color: var(--nc-line-btn); }
.nc-opt .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-opt .cnt { font-family: var(--nc-mono); font-size: 10px; opacity: 0.75; flex-shrink: 0; }
.nc-rail-foot { margin-top: auto; padding-top: 26px; }
.nc-rail-foot .hr { height: 1px; background: var(--nc-line-hair); margin-bottom: 18px; }
.nc-rail-foot .meta { font-family: var(--nc-mono); font-size: 10px; line-height: 1.7; color: var(--nc-muted-3); letter-spacing: 0.06em; }

/* ── Grid ──────────────────────────────────────────────── */
.nc-main { flex: 1; overflow-y: auto; padding: 26px 30px 40px; min-width: 0; }
.nc-main-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.nc-main-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nc-h1 { font-family: var(--nc-head); font-size: 17px; font-weight: 700; letter-spacing: 0.06em; color: var(--nc-text); }
.nc-h1 .sub { color: var(--nc-muted); font-weight: 400; }
.nc-sortwrap { display: flex; align-items: center; gap: 14px; }
.nc-sort-group { display: flex; align-items: center; gap: 7px; }
.nc-sort-lbl { font-family: var(--nc-body); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--nc-muted-3); }
.nc-sort { padding: 5px 12px; background: transparent; color: var(--nc-muted-2); border: 1px solid var(--nc-line-btn); cursor: pointer; font-family: var(--nc-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; transition: all 150ms ease; }
.nc-sort.on { background: var(--nc-cyan); color: var(--nc-navy); border-color: var(--nc-cyan); }
.nc-count { font-family: var(--nc-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--nc-muted); }

.nc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.nc-card { position: relative; background: var(--nc-panel); border: 1px solid rgba(0,240,255,0.22); cursor: pointer; overflow: hidden; transition: all 180ms ease; }
.nc-card:hover { border-color: var(--nc-cyan); box-shadow: 0 0 0 1px var(--nc-cyan), 0 10px 30px rgba(0,240,255,0.14); transform: translateY(-2px); }
.nc-shot { position: relative; aspect-ratio: 16/9; overflow: hidden; background: var(--nc-panel-2); }
.nc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nc-bracket { position: absolute; width: 14px; height: 14px; opacity: 0.75; }
.nc-bracket.tl { top: 7px; left: 7px; border-top: 1px solid var(--nc-cyan); border-left: 1px solid var(--nc-cyan); }
.nc-bracket.br { bottom: 7px; right: 7px; border-bottom: 1px solid var(--nc-cyan); border-right: 1px solid var(--nc-cyan); }
.nc-time { position: absolute; top: 7px; right: 7px; display: flex; align-items: center; gap: 5px; font-family: var(--nc-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--nc-cyan); background: rgba(5,10,14,0.82); padding: 2px 7px; }
.nc-time .dot { width: 5px; height: 5px; background: var(--nc-green); border-radius: 50%; }
.nc-stage { position: absolute; bottom: 7px; left: 7px; font-family: var(--nc-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--nc-amber); background: rgba(5,10,14,0.82); padding: 2px 7px; border: 1px solid rgba(255,179,0,0.4); }
.nc-new { position: absolute; top: 7px; left: 7px; display: flex; align-items: center; gap: 5px; font-family: var(--nc-mono); font-size: 9px; font-weight: 500; letter-spacing: 0.12em; color: var(--nc-navy); background: var(--nc-cyan); padding: 3px 8px; }
.nc-new .dot { width: 5px; height: 5px; background: var(--nc-navy); border-radius: 50%; }
.nc-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 13px; border-top: 1px solid var(--nc-line-soft); }
.nc-card-id { font-family: var(--nc-mono); font-size: 10px; color: var(--nc-muted); letter-spacing: 0.03em; white-space: nowrap; }
.nc-card-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nc-card-t .a { font-family: var(--nc-head); font-size: 13px; font-weight: 600; color: var(--nc-text); letter-spacing: 0.03em; }
.nc-card-t .b { font-family: var(--nc-body); font-size: 12px; color: var(--nc-muted); letter-spacing: 0.12em; text-transform: uppercase; }

/* ── Empty state ───────────────────────────────────────── */
.nc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 80px 20px; border: 1px dashed rgba(0,240,255,0.28); background: rgba(6,13,24,0.4); }
.nc-empty .ico { width: 44px; height: 44px; border: 2px solid rgba(0,240,255,0.5); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--nc-mono); font-size: 20px; color: var(--nc-cyan); }
.nc-empty .t { font-family: var(--nc-head); font-size: 15px; font-weight: 700; letter-spacing: 0.08em; color: var(--nc-text); }
.nc-empty .d { font-family: var(--nc-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--nc-muted); }
.nc-empty button { margin-top: 6px; background: var(--nc-cyan); color: var(--nc-navy); border: none; cursor: pointer; padding: 9px 18px; font-family: var(--nc-head); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; }

/* ── Lightbox / reader ─────────────────────────────────── */
.nc-lb { position: fixed; inset: 0; z-index: 9999; background: rgba(2,6,12,0.95); backdrop-filter: blur(7px); display: flex; flex-direction: column; padding: 20px 26px; }
.nc-lb-top { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.nc-lb-top .brand { display: flex; align-items: center; gap: 14px; }
.nc-lb-top .brand img { height: 26px; width: auto; filter: brightness(0) invert(1); opacity: 0.8; }
.nc-lb-pos { font-family: var(--nc-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--nc-cyan); }
.nc-lb-close { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid rgba(136,146,176,0.4); color: var(--nc-text); cursor: pointer; padding: 8px 15px; font-family: var(--nc-mono); font-size: 12px; letter-spacing: 0.1em; transition: all 150ms ease; }
.nc-lb-close:hover { border-color: var(--nc-cyan); color: var(--nc-cyan); }
.nc-lb-body { flex: 1; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 0; padding: 12px 0; }
.nc-lb-nav { flex-shrink: 0; width: 52px; height: 52px; background: rgba(10,25,47,0.7); border: 1px solid rgba(0,240,255,0.35); color: var(--nc-cyan); cursor: pointer; font-size: 22px; font-family: var(--nc-mono); transition: all 150ms ease; }
.nc-lb-nav:hover { background: var(--nc-cyan); color: var(--nc-navy); }
.nc-lb-fig { display: flex; flex-direction: column; flex: 1; min-width: 0; max-width: min(1760px, 94vw); max-height: 100%; min-height: 0; }
.nc-lb-imgwrap { position: relative; display: flex; flex: 1; min-height: 0; align-items: center; justify-content: center; cursor: zoom-in; }
/* Swipe-hint arrows overlaid on the image (mobile only; desktop uses side nav). */
.nc-lb-swipe { display: none; }
.nc-lb-fig img { max-width: 100%; max-height: 82vh; object-fit: contain; display: block; border: 1px solid rgba(0,240,255,0.3); background: var(--nc-panel-2); }
.nc-lb-meta { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 4px 2px; flex-wrap: wrap; flex-shrink: 0; }
.nc-lb-meta-l { display: flex; flex-direction: column; gap: 8px; }
.nc-lb-titlerow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nc-lb-title { font-family: var(--nc-head); font-size: 22px; font-weight: 700; letter-spacing: 0.04em; color: var(--nc-text); }
.nc-lb-title .d { color: var(--nc-muted); font-weight: 400; font-size: 15px; }
.nc-lb-tag { font-family: var(--nc-body); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--nc-amber); border: 1px solid rgba(255,179,0,0.45); padding: 3px 10px; }
.nc-lb-facts { display: flex; gap: 10px 20px; font-family: var(--nc-body); font-size: 14px; letter-spacing: 0.05em; color: var(--nc-muted-2); flex-wrap: wrap; }
.nc-lb-fact { display: inline-flex; align-items: center; gap: 7px; cursor: default; }
.nc-ic { width: 15px; height: 15px; color: var(--nc-cyan); flex-shrink: 0; }
.nc-lb-meta-r { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.nc-lb-id { font-family: var(--nc-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--nc-muted); }
.nc-dl { display: flex; align-items: center; gap: 9px; white-space: nowrap; flex-shrink: 0; background: var(--nc-cyan); color: var(--nc-navy); padding: 11px 20px; font-family: var(--nc-head); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; transition: all 150ms ease; }
.nc-dl:hover { background: var(--nc-cyan-soft); color: var(--nc-navy); }
/* fullscreen click-to-zoom overlay */
.nc-lb-zoom { position: fixed; inset: 0; z-index: 10000; background: rgba(1,4,9,0.97); display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 10px; }
.nc-lb-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── Mobile drawer ─────────────────────────────────────── */
.nc-drawer-btn { flex-shrink: 0; display: none; align-items: center; gap: 7px; background: transparent; border: 1px solid rgba(0,240,255,0.4); color: var(--nc-cyan); cursor: pointer; padding: 7px 12px; font-family: var(--nc-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.nc-rail-close { display: none; align-self: flex-end; margin-bottom: 14px; background: transparent; border: 1px solid rgba(136,146,176,0.4); color: var(--nc-text); cursor: pointer; padding: 7px 13px; font-family: var(--nc-mono); font-size: 12px; letter-spacing: 0.1em; }
.nc-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(2,6,12,0.6); backdrop-filter: blur(2px); }

@media (max-width: 760px) {
  .nc-status { display: none; }
  /* On mobile the document itself scrolls (not an inner pane) so the browser's
     pull-to-refresh works. Release the desktop shell's height cap + overflow
     lock on html/body, or nothing scrolls. The header sticks + auto-hides. */
  html { height: auto; }
  body { height: auto; overflow: visible; }
  .nc-app { height: auto; min-height: 100svh; overflow: visible; }
  .nc-body-row { display: block; }
  .nc-main { overflow: visible; padding: 20px 18px 40px; }
  /* Header stacks to two rows: [logo + title] / [nav], sticky + auto-hide. */
  .nc-header {
    position: sticky; top: 0; z-index: 100;
    flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px;
    transition: transform 260ms ease, opacity 200ms ease;
  }
  .nc-header-right { justify-content: center; gap: 18px; }
  .nc-nav { width: 100%; justify-content: center; gap: 20px; }
  .nc-app.header-hidden .nc-header { transform: translateY(-100%); opacity: 0; pointer-events: none; }
  .nc-brand img { height: 34px; }
  .nc-brand-title { font-size: 19px; }
  .nc-drawer-btn { display: flex; }
  .nc-rail-close { display: block; }
  .nc-rail {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 85vw); z-index: 200;
    background: var(--nc-navy); transform: translateX(-100%); transition: transform 220ms ease;
  }
  .nc-app.drawer-open .nc-rail { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.6); }

  /* Mobile lightbox: full-bleed image, swipe to navigate (side arrows hidden),
     metadata stacked below. Fixes the image rendering smaller than a thumbnail. */
  .nc-lb { padding: 12px 12px 16px; }
  .nc-lb-body { gap: 0; padding: 10px 0; }
  .nc-lb-nav { display: none; }
  .nc-lb-fig { max-width: 100%; width: 100%; }
  .nc-lb-fig img { max-height: 66vh; width: 100%; }
  /* Overlaid swipe-hint arrows — thin, borderless, edge-flush scrims that
     stay out of the way of the image. Also tappable. */
  .nc-lb-swipe {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 30px; height: auto; padding: 7px 0; border: none; border-radius: 0;
    background: rgba(6,13,24,0.2); color: rgba(224,232,247,0.65);
    font-family: var(--nc-mono); font-size: 26px; line-height: 1; cursor: pointer;
  }
  .nc-lb-swipe.prev { left: 0; }
  .nc-lb-swipe.next { right: 0; }
  .nc-lb-meta { flex-direction: column; align-items: stretch; gap: 14px; padding-top: 14px; }
  .nc-lb-meta-r { justify-content: space-between; }
  .nc-lb-facts { gap: 8px 16px; font-size: 13px; }
}
