/* Literature galaxy (components/pages/canvas.py tab 'literature_galaxy', lg_galaxy.js): lg- classes only.
   Tokens as the rest of the app: panels rgba(0,0,0,.6), text #e8e8e8, muted #9fb3c8, headings #cfefff,
   accent #f0a030, glow #4be9fa. */

.lg-root { position: relative; width: 100%; flex: 1 1 auto; height: 100%; min-height: 480px; overflow: hidden;
  border-radius: 14px; border: 1px solid rgba(255,255,255,0.07);
  background: radial-gradient(ellipse at 30% 20%, #0d1b2e 0%, #060a12 55%, #020308 100%);
  box-shadow: inset 0 0 120px rgba(0,0,0,0.8); color: #e8e8e8; font-size: .8rem; user-select: none; }
/* full screen: the same scene fixed over the whole window (lg_galaxy.js setMax) */
.lg-root.lg-max { position: fixed; inset: 0; width: 100vw; height: 100vh; min-height: 0; z-index: 5000;
  border-radius: 0; border: none; }
.lg-gl { position: absolute; inset: 0; }
.lg-gl canvas { display: block; outline: none; }
.lg-root.grab .lg-gl { cursor: grabbing; }
.lg-root.hovering .lg-gl { cursor: pointer; }

/* loading veil */
.lg-veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #9fb3c8; z-index: 30; background: radial-gradient(circle, rgba(6,10,18,0.2), rgba(2,3,8,0.95));
  transition: opacity .9s ease; }
.lg-veil.gone { opacity: 0; pointer-events: none; }
.lg-orbit { width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(75,233,250,0.25); position: relative;
  animation: lg-spin 2.4s linear infinite; }
.lg-orbit::before, .lg-orbit::after { content: ''; position: absolute; border-radius: 50%; }
.lg-orbit::before { width: 10px; height: 10px; top: -5px; left: 27px; background: #4be9fa; box-shadow: 0 0 16px #4be9fa; }
.lg-orbit::after { width: 6px; height: 6px; bottom: 6px; right: 4px; background: #f0a030; box-shadow: 0 0 12px #f0a030; }
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* glass panels */
.lg-glass { background: rgba(4,8,14,0.62); border: 1px solid rgba(255,255,255,0.09); border-radius: 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,0.45); }

/* left control panel */
.lg-panel { position: absolute; top: 12px; left: 12px; bottom: 12px; width: 286px; z-index: 12; display: flex;
  flex-direction: column; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.lg-panel.closed { transform: translateX(-300px); opacity: 0; pointer-events: none; }
.lg-phead { padding: 12px 14px 8px; }
.lg-title { font-size: 1.02rem; color: #cfefff; font-weight: 600; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.lg-title i { color: #4be9fa; text-shadow: 0 0 12px #4be9fa; }
.lg-count { color: #7f93a8; font-size: .7rem; margin-top: 2px; }
.lg-pbody { overflow-y: auto; padding: 0 14px 14px; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
.lg-sec { margin-top: 12px; }
.lg-sec-t { color: #7f93a8; font-size: .6rem; text-transform: uppercase; letter-spacing: 1.1px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; }
.lg-lenses { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lg-lens { border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); border-radius: 10px;
  padding: 7px 8px; cursor: pointer; color: #cfdcea; text-align: left; transition: all .2s; min-height: 50px; }
.lg-lens i { color: var(--c, #4be9fa); font-size: .9rem; display: block; margin-bottom: 3px; }
.lg-lens span { font-size: .68rem; line-height: 1.15; display: block; }
.lg-lens:hover { border-color: var(--c, #4be9fa); background: rgba(255,255,255,0.06); }
.lg-lens.on { border-color: var(--c, #4be9fa); background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(0,0,0,0));
  box-shadow: 0 0 18px -6px var(--c, #4be9fa), inset 0 0 12px -8px var(--c, #4be9fa); color: #fff; }
.lg-seg { display: flex; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 9px; padding: 2px; }
.lg-seg button { flex: 1; border: none; background: transparent; color: #9fb3c8; font-size: .66rem; padding: 5px 4px;
  border-radius: 7px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.lg-seg button:hover { color: #fff; }
.lg-seg button.on { background: rgba(240,160,48,0.18); color: #f5d6a3; box-shadow: inset 0 0 0 1px rgba(240,160,48,0.45); }
.lg-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.lg-tg { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #cfdcea; font-size: .7rem; padding: 2px 0; }
.lg-tg input { display: none; }
.lg-tg .sw { width: 24px; height: 13px; border-radius: 7px; background: rgba(255,255,255,0.12); position: relative; transition: background .2s; flex: 0 0 24px; }
.lg-tg .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: #9fb3c8; transition: all .2s; }
.lg-tg input:checked + .sw { background: rgba(75,233,250,0.35); }
.lg-tg input:checked + .sw::after { left: 13px; background: #4be9fa; box-shadow: 0 0 8px #4be9fa; }
.lg-search { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); color: #7f93a8; }
.lg-search:focus-within { border-color: rgba(240,160,48,0.7); }
.lg-search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: #e8e8e8; font-size: .74rem; }
.lg-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lg-chip { border: 1px solid var(--c, rgba(255,255,255,0.2)); color: #cfdcea; background: transparent; border-radius: 999px;
  padding: 2px 9px; font-size: .64rem; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 5px; }
.lg-chip i.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.lg-chip.off { opacity: .35; border-style: dashed; }
.lg-years { display: flex; align-items: center; gap: 6px; color: #9fb3c8; font-size: .66rem; }
.lg-years input[type=range] { flex: 1; accent-color: #f0a030; }
.lg-hint { color: #7f93a8; font-size: .64rem; line-height: 1.4; margin-top: 6px; }

/* top-right: collapse + fullscreen buttons */
.lg-tools { position: absolute; top: 12px; right: 12px; z-index: 14; display: flex; gap: 6px; }
.lg-btn { height: 30px; min-width: 30px; padding: 0 9px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(4,8,14,0.62); color: #cfdcea; cursor: pointer; font-size: .72rem; display: inline-flex; align-items: center;
  gap: 6px; backdrop-filter: blur(8px); transition: all .2s; }
.lg-btn:hover { border-color: #f0a030; color: #f5d6a3; }
.lg-btn.on { border-color: #4be9fa; color: #4be9fa; }
.lg-open-panel { position: absolute; top: 12px; left: 12px; z-index: 11; }

/* legend (clusters of the current lens) */
.lg-legend { position: absolute; right: 12px; top: 52px; z-index: 12; width: 240px; max-height: calc(100% - 170px);
  overflow-y: auto; padding: 10px 12px; scrollbar-width: thin; transition: opacity .3s, transform .45s cubic-bezier(.2,.8,.2,1); }
.lg-legend.shifted { transform: translateX(calc(-1 * var(--lg-off, 0px))); }
.lg-leg-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; cursor: pointer;
  color: #cfdcea; font-size: .7rem; transition: background .2s, opacity .2s; }
.lg-leg-row:hover { background: rgba(255,255,255,0.06); }
.lg-leg-row .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.lg-leg-row .n { margin-left: auto; color: #7f93a8; font-size: .62rem; }
.lg-leg-row.off { opacity: .35; }
.lg-leg-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* lens caption (bottom centre) */
.lg-caption { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 10; max-width: min(720px, 60%);
  text-align: center; padding: 8px 16px; color: #cfdcea; font-size: .74rem; line-height: 1.4; transition: opacity .5s; pointer-events: none; }
.lg-caption b { color: var(--c, #4be9fa); font-weight: 600; }

/* HTML labels (clusters, axes, years, suns) */
.lg-labels { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.lg-lbl { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; will-change: transform, opacity;
  transition: opacity .35s; }
.lg-lbl.cl { font-size: .74rem; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--c);
  text-shadow: 0 0 14px var(--c), 0 0 3px rgba(0,0,0,0.9); padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.25); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); pointer-events: auto; cursor: pointer; }
.lg-lbl.cl:hover { background: rgba(0,0,0,0.55); }
.lg-lbl.ax { font-size: .64rem; color: #9fb3c8; letter-spacing: .4px; text-shadow: 0 0 6px #000; }
.lg-lbl.ax b { color: #cfefff; font-weight: 600; }
.lg-lbl.yr { font-size: .62rem; color: rgba(207,239,255,0.55); letter-spacing: 1px; }
.lg-lbl.sun { font-size: .66rem; color: #ffe8b0; text-shadow: 0 0 10px #f0a030; font-weight: 600; transform: translate(-50%, 16px); }
.lg-lbl.pt { font-size: .62rem; color: #e8e8e8; text-shadow: 0 0 6px #000, 0 0 2px #000; transform: translate(10px, -50%); max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; opacity: .85; }

/* hover tooltip */
.lg-tip { position: absolute; z-index: 20; pointer-events: none; width: 330px; padding: 10px 12px; opacity: 0;
  transform: translateY(6px); transition: opacity .15s, transform .15s; }
.lg-tip.on { opacity: 1; transform: none; }
.lg-tip .tt { color: #fff; font-size: .8rem; font-weight: 600; line-height: 1.3; }
.lg-tip .tm { color: #9fb3c8; font-size: .66rem; margin-top: 4px; }
.lg-tip .tk { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.lg-tip .tk span { font-size: .6rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--c, rgba(255,255,255,0.2)); color: #cfdcea; }
.lg-tip .tf { margin-top: 7px; font-size: .62rem; color: #7f93a8; display: flex; justify-content: space-between; gap: 8px; }
.lg-tip .tf b { color: #f5d6a3; font-weight: 600; }
.lg-tip .bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,0.08); margin-top: 6px; overflow: hidden; }
.lg-tip .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--c, #4be9fa), #fff); }

/* details offcanvas (paper + PDF) */
.lg-oc { position: absolute; top: 0; right: 0; bottom: 0; width: min(62%, 980px); z-index: 25; display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .5s cubic-bezier(.2,.8,.2,1); border-radius: 14px 0 0 14px;
  background: rgba(5,9,15,0.93); border-left: 1px solid rgba(255,255,255,0.1); box-shadow: -20px 0 60px rgba(0,0,0,0.6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.lg-oc.on { transform: none; }
.lg-oc-h { padding: 14px 16px 10px; border-bottom: 1px solid rgba(255,255,255,0.07); position: relative; }
.lg-oc-x { position: absolute; top: 10px; right: 10px; }
.lg-oc-kind { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; padding-right: 90px; }
.lg-oc-kind span { font-size: .6rem; text-transform: uppercase; letter-spacing: .8px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--c, rgba(255,255,255,0.25)); color: var(--c, #cfdcea); }
.lg-oc-t { color: #fff; font-size: 1.02rem; font-weight: 600; line-height: 1.3; padding-right: 30px; user-select: text; }
.lg-oc-m { color: #9fb3c8; font-size: .72rem; margin-top: 4px; user-select: text; }
.lg-oc-kw { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.lg-oc-kw span { font-size: .62rem; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.05); color: #cfdcea; }
.lg-oc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lg-oc-acts a { text-decoration: none; }
.lg-oc-abs { color: #cfdcea; font-size: .74rem; line-height: 1.5; margin-top: 10px; max-height: 150px; overflow-y: auto;
  user-select: text; padding-right: 6px; }
.lg-oc-abs.closed { display: none; }
.lg-oc-nn { margin-top: 10px; }
.lg-oc-nn .lg-sec-t { margin-bottom: 4px; }
.lg-nns { display: flex; flex-wrap: wrap; gap: 5px; }
.lg-nn { display: inline-flex; align-items: center; gap: 6px; max-width: 49%; padding: 3px 9px 3px 7px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); color: #cfdcea; font-size: .66rem; cursor: pointer;
  transition: all .2s; }
.lg-nn:hover { border-color: var(--c); background: rgba(255,255,255,0.07); color: #fff; }
.lg-nn i { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.lg-nn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lg-nn em { color: #7f93a8; font-style: normal; font-size: .58rem; flex: 0 0 auto; }
.lg-oc-b { flex: 1; min-height: 0; position: relative; }
.lg-oc-b iframe { width: 100%; height: 100%; border: none; background: #1b1f24; border-radius: 0 0 0 14px; }
.lg-oc-none { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #7f93a8; text-align: center; padding: 24px; }
.lg-oc-none i.big { font-size: 2.2rem; color: rgba(75,233,250,0.35); }
