/* Copyright (c) 2026 William Chesher */
/* SPDX-License-Identifier: MIT */
/* teenyverse · new product surfaces — shared chrome
 * Consumes the design system (styles.css). Only adds layout scaffolding
 * + a few patterns the .tv-* primitives don't cover. Elegant, restrained,
 * neon-on-navy. Everything lowercase. Glow is seasoning, not sauce.
 */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body); font-weight: var(--weight-light);
  color: var(--text-primary); -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
  /* clear the fixed unified nav bar (teenyverse-nav.js makes
     <header id="header"> position:fixed, 3.5em tall, removing it from flow).
     The x-shell stack has no `body.layout-standard main { padding-top }`
     offset the legacy shell.css provides, so without this the page top sits
     under the bar and is cut off. Single source of truth for every surface
     that loads this stylesheet; mirrors the inline fix the nav redirect
     stubs already carry. */
  padding-top: 3.5em;
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- the void ---- */
/* min-height accounts for the 3.5em body padding-top above so a full-height
   surface fills the viewport exactly instead of overflowing by the bar's height. */
.x-shell { position: relative; min-height: calc(100vh - 3.5em); display: flex; flex-direction: column; overflow: hidden; }
.x-shell::before { /* page void */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 12%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 52%),
    radial-gradient(ellipse at 86% 88%, color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 50%),
    linear-gradient(180deg, #070710 0%, #0a0a18 48%, #0c0c1e 100%);
}
.x-shell::after { /* faint accent grid */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 3.5%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--accent) 3.5%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
          mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
}
.x-shell > * { position: relative; z-index: 1; }

/* cyberpink void — pink-black nebula lit by cyan + violet counter-glows */
.x-shell.theme-cyberpink::before {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(255,46,136,.17) 0%, transparent 52%),
    radial-gradient(ellipse at 84% 22%, rgba(177,77,255,.12) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 86%, rgba(5,217,232,.08) 0%, transparent 50%),
    linear-gradient(180deg, #0a0410 0%, #11030d 48%, #16041b 100%);
}

/* sparse drifting dots — drop <div class="x-dust"><i></i>×8</div> */
.x-dust { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.x-dust i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 7px var(--accent), 0 0 14px var(--accent);
  opacity: 0; animation: x-rise 22s infinite ease-in-out;
}
@keyframes x-rise {
  0%,100% { transform: translateY(105%) scale(0); opacity: 0; }
  6% { opacity: .7; } 94% { opacity: .55; }
  100% { transform: translateY(-8%) scale(1); opacity: 0; }
}
.x-dust i:nth-child(1){left:11%;animation-delay:0s;animation-duration:24s}
.x-dust i:nth-child(2){left:23%;animation-delay:4s;animation-duration:19s}
.x-dust i:nth-child(3){left:37%;animation-delay:9s;animation-duration:26s}
.x-dust i:nth-child(4){left:49%;animation-delay:2s;animation-duration:21s}
.x-dust i:nth-child(5){left:62%;animation-delay:7s;animation-duration:18s}
.x-dust i:nth-child(6){left:74%;animation-delay:12s;animation-duration:23s}
.x-dust i:nth-child(7){left:85%;animation-delay:5s;animation-duration:20s}
.x-dust i:nth-child(8){left:94%;animation-delay:10s;animation-duration:25s}
@media (prefers-reduced-motion: reduce){ .x-dust i{ animation:none; opacity:.4; top:42%; } }

/* ---- header ---- */
.x-head {
  height: 3.5em; flex: none; display: flex; align-items: center; gap: 1.4em;
  padding: 0 1.8em; background: #14141f; position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 2px 14px rgba(0,0,0,.4);
}
.x-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--strip-grad); opacity: .85; }
.x-logo { display: flex; align-items: center; gap: .5em; font-family: var(--font-display); font-weight: 600; font-size: 1.22em; color: #fff; text-transform: lowercase; letter-spacing: .3px; }
.x-logo img { width: 1.15em; height: 1.15em; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 70%, transparent)); }
.x-logo .x-sub { font-family: var(--font-mono); font-size: .5em; font-weight: 500; letter-spacing: .18em; color: var(--accent); text-transform: lowercase; padding: .25em .5em; border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: 999px; margin-left: .3em; }
.x-nav { display: flex; gap: 1.15em; align-items: center; margin-left: .8em; font-size: 1.05em; }
.x-nav a { color: rgba(255,255,255,.42); text-decoration: none; transition: color .2s, text-shadow .2s; cursor: pointer; }
.x-nav a:hover { color: rgba(255,255,255,.8); }
.x-nav a.on { color: var(--accent); text-shadow: 0 0 12px var(--accent); }
.x-head-right { margin-left: auto; display: flex; align-items: center; gap: 1em; }
.x-tier {
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .08em; text-transform: lowercase;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, transparent); padding: .28em .7em; border-radius: 999px;
  display: inline-flex; align-items: center; gap: .45em;
}
.x-ava { width: 2em; height: 2em; border-radius: 50%; border: 1px solid var(--border-default); background: var(--bg-secondary); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; font-size: .85em; }

/* ---- shared type helpers ---- */
.x-eyebrow { font-family: var(--font-mono); font-size: .62rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.x-eyebrow.accent { color: var(--accent); }
.x-display { font-family: var(--font-display); font-weight: 600; text-transform: lowercase; color: #fff; line-height: 1.05; letter-spacing: .3px; }
.x-mono { font-family: var(--font-mono); }
.x-muted { color: var(--text-muted); }
.x-sec { color: var(--text-secondary); }
.x-page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 2em var(--page-pad) 4em; }

/* hairline divider */
.x-hr { height: 1px; background: var(--border-light); border: 0; margin: 0; }

/* glow ring used on focal numbers / orbs */
.x-orb { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }

/* refined scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 26%, transparent); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* a quietly elegant primary */
.x-cta {
  display: inline-flex; align-items: center; gap: .55em; cursor: pointer;
  font-family: var(--font-body); font-weight: 500; font-size: .9rem; text-transform: lowercase;
  padding: .7em 1.3em; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: #06121e;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  transition: box-shadow .3s var(--ease-out-expo), transform .2s, filter .2s;
}
.x-cta:hover { filter: brightness(1.08); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent); transform: translateY(-1px); }
.x-ghost {
  display: inline-flex; align-items: center; gap: .5em; cursor: pointer;
  font-family: var(--font-body); font-weight: 400; font-size: .85rem; text-transform: lowercase;
  padding: .65em 1.15em; border-radius: 999px; border: 1px solid var(--border-default);
  background: transparent; color: var(--text-secondary); transition: all .2s;
}
.x-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* editable affordance — tells the student a field can be written into */
[contenteditable="true"] { cursor: text; transition: outline-color .15s, box-shadow .15s; }
[contenteditable="true"]:hover { outline: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; border-radius: 6px; }
[contenteditable="true"]:focus { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 22%, transparent); }

/* sprite icons (teeny-icons.js) — inherit text color + size like a glyph.
   Symbols carry fill="currentColor"; sizing matches the old <i> font-size. */
svg.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; fill: currentColor; }

/* page-header / breadcrumbs / site-footer — additive port of the admin.css
   idioms used by instance surfaces (e.g. air_quality/calibrate) that were
   never restyled for the x-shell stack. Theme-variable driven so they render
   correctly in the neon dark scheme instead of admin.css's hard #000. Added
   for the calibrate migration; safe for any surface that keeps these classes. */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5em; }
.page-header h1 { margin: 0 0 .5em; font-size: 1.5em; color: var(--text-primary); }
.page-header .breadcrumbs { margin-bottom: 0; }
.page-header h1 svg.ic { width: 1.2em; height: 1.2em; color: var(--accent); margin-right: .3em; vertical-align: middle; }
.breadcrumbs { font-size: .85em; color: var(--text-muted); margin-bottom: .5em; }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .separator { margin: 0 .5em; color: var(--border-default); }
.breadcrumbs .current { color: var(--text-primary); }
.site-footer { text-align: center; padding: 2em 1em; margin-top: 2em; border-top: 1px solid var(--border-light); color: var(--text-secondary); font-size: .85em; }
.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .separator { margin: 0 .5em; color: var(--border-default); }
@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
/* investigation status pill — the lifecycle badge on every investigation
   card. Shared canon (previously lived in admin.css; carried here when the
   investigate surface moved to the x-shell stack so the pills keep their
   colour after admin.css is dropped). The variant class is the raw status
   token (draft/open/paused/concluded/under_review/published/archived). */
.investigation-status {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-weight: 500; font-size: 0.78rem; line-height: 1.5;
  background: rgba(255, 255, 255, 0.08); color: var(--text-secondary);
}
.investigation-status.draft        { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.investigation-status.open         { background: rgba(34, 197, 94,  0.18); color: #6ee7b7; }
.investigation-status.paused       { background: rgba(239, 108, 0,  0.18); color: #fcd34d; }
.investigation-status.concluded    { background: rgba(168, 85,  247, 0.18); color: #d8b4fe; }
.investigation-status.under-review,
.investigation-status.under_review { background: rgba(245, 158, 11, 0.20); color: #fcd34d; }
.investigation-status.published    { background: rgba(33,  150, 243, 0.18); color: #90caf9; }
.investigation-status.archived     { background: rgba(96,  125, 139, 0.18); color: #b0bec5; }

/* circle-btn — small round icon-button used on table row actions.
   Ported from admin.css for x-shell surfaces that retain imperative tables.
   Theme-var driven (accent, --surface-card) so it renders in neon dark. */
.circle-btn {
  width: 2rem; height: 2rem; min-width: 2rem; aspect-ratio: 1;
  border-radius: 50%; border: 1px solid var(--border-light);
  background: var(--surface-card); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; font-size: 0.85rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); flex-shrink: 0; padding: 0;
}
.circle-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }
.circle-btn:active { transform: translateY(0); box-shadow: none; }
.circle-btn.danger { border-color: rgba(244,67,54,.4); color: #ef5350; }
.circle-btn.danger:hover { background: rgba(244,67,54,.12); border-color: #ef5350; color: #ef5350; }
.circle-btn svg { width: 0.9rem; height: 0.9rem; fill: currentColor; }

/* .alert — inline status message bar. Used by x-shell admin pages that
   replace admin.js's showAlert() with a small inline helper. */
.alert {
  padding: .85em 1.1em; border-radius: 8px; margin-bottom: 1em;
  font-size: .9rem; line-height: 1.5;
  background: var(--surface-card); color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.alert.success { background: rgba(76,175,80,.1); color: #81c784; border-color: rgba(76,175,80,.3); }
.alert.error   { background: rgba(244,67,54,.1); color: #ef9a9a; border-color: rgba(244,67,54,.3); }
.alert.warning { background: rgba(255,152,0,.1);  color: #ffcc80; border-color: rgba(255,152,0,.3); }
.alert.info    { background: rgba(5,217,232,.08); color: var(--accent); border-color: rgba(5,217,232,.25); }

/* header-actions + action-btn — additive port of the admin.css idioms used by
   operate surfaces (e.g. arrivals: the round refresh / upload icon buttons in
   a .fleet-header). Theme-variable driven so they render in the neon dark
   scheme instead of admin.css's hard #000/#555. Added for the arrivals (admin
   root) migration; safe for any surface that keeps these classes. */
.header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.action-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-default); background: var(--bg-secondary);
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.2s ease;
}
.action-btn:hover:not(:disabled) {
  border-color: var(--accent); color: var(--accent); background: var(--accent-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 25%, transparent);
}
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.action-btn.primary { background: var(--accent); border-color: var(--accent); color: #06121e; }
.action-btn.primary:hover:not(:disabled) { filter: brightness(1.08); color: #06121e; }
.action-btn svg, .action-btn i, .action-btn svg.ic { width: 18px; height: 18px; }
