/* QI Data Bank: the feed, the viewer, the upload form and the admin page. Loaded after /tools/css/studio.css
   (colours, buttons, header), and by the studio itself for the nav and "Share to Data Bank". */

/* nav */
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a:not(.x-link) {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px;
}
.site-nav a:not(.x-link):hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.site-nav .x-link { margin-left: 8px; }
.site-nav a { white-space: nowrap; }
@media (max-width: 520px) {
  .site-header { padding-left: 14px; padding-right: 14px; }
  .brand { gap: 9px; }
  .brand-name { font-size: 13px; letter-spacing: .1em; white-space: nowrap; }
  .site-nav { gap: 0; }
  .site-nav a:not(.x-link) { padding: 7px 6px; font-size: 13px; }
  .site-nav .x-link { margin-left: 4px; width: 34px; height: 34px; }
  .seg.bank-tabs button { padding: 8px 9px; }
}

/* page */
.bank { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 48px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
a.primary, a.secondary { text-decoration: none; }

.bank-tabs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: auto; margin-bottom: 18px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.bank-tabs button { padding: 8px 16px; white-space: nowrap; }

/* grid */
.grid { display: flex; gap: 14px; align-items: flex-start; min-height: 120px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.grid-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0; color: var(--muted); text-align: center; }
.grid-state p { margin: 0; }
.grid-state:empty { display: none; }
.sentinel { height: 1px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card.fly { animation: fly-in .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fly-in {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card.fly { animation: none; }
  .card:hover { transform: none; }
}
.card-hit { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; color: inherit; }
.card-media { position: relative; background: #070b22; }
.card-media img, .no-thumb { width: 100%; display: block; object-fit: cover; }
.no-thumb { background: radial-gradient(circle at 50% 40%, #17215a, #070b22 70%); }
.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(3, 6, 20, .72); border: 1px solid rgba(255, 255, 255, .22); color: #fff; backdrop-filter: blur(4px);
}
.play svg { width: 22px; height: 22px; margin-left: 3px; }
.card-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px 11px; }
.card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-by { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--accent);
  border: 1px solid rgba(127, 220, 255, .35); border-radius: 999px; padding: 2px 8px;
}

.card-post .card-hit { padding: 14px 16px 14px; }
.post-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-head svg { width: 15px; height: 15px; stroke: none; }
.post-author { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-handle { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-title { margin: 10px 0 0; font-weight: 600; font-size: 14px; color: var(--accent); }
.post-text {
  margin: 8px 0 10px; font-size: 14.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 10; -webkit-box-orient: vertical; overflow: hidden;
}
.post-date { color: var(--muted); font-size: 12.5px; }

/* viewer */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 14px clamp(12px, 3vw, 28px) 18px;
  border: 0; color: var(--text);
  display: none; flex-direction: column; gap: 12px;
}
.lightbox[open] { display: flex; }
.bank-page .lightbox { background: transparent; }
.lightbox::backdrop { background: rgba(2, 6, 17, .76); backdrop-filter: blur(4px); }
.lb-top { display: flex; justify-content: flex-end; }
.lb-stage { flex: 1; min-height: 0; position: relative; display: flex; }
.lb-media { width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px; }
.lightbox .icon-btn { border: 0; border-radius: 50%; color: var(--text); background: rgba(2, 6, 17, .5); }
.lightbox .icon-btn:hover:not(:disabled) { background: rgba(18, 43, 62, .85); }
.lightbox .icon-btn:disabled { opacity: .3; cursor: default; }
.lb-nav { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); }
#lb-prev { left: 0; }
#lb-next { right: 0; }
.lb-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lb-media video { max-width: 100%; max-height: 100%; border-radius: 10px; display: block; background: #000; }
.lb-post { flex-direction: column; overflow-y: auto; justify-content: flex-start; padding-top: 2vh; }
.post-full {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px 20px;
}
.post-full .post-text { -webkit-line-clamp: unset; display: block; font-size: 16px; }
.post-embed { width: min(560px, 100%); }
.post-embed:empty { display: none; }
.lb-info { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; width: 100%; max-width: 1100px; margin: 0 auto; }
.lb-text { min-width: 0; }
.lb-text h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.lb-text p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-actions .small { height: 38px; }
.lb-actions svg { width: 16px; height: 16px; }
.lb-actions svg path[fill] { stroke: none; }
@media (max-width: 700px) {
  .lb-media { padding: 0; }
  .lb-info { gap: 12px; }
  .lb-actions { gap: 8px; }
}

/* forms */
.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 18px;
}
.modal::backdrop { background: rgba(2, 3, 12, .75); }
.modal .ed-head h2 { font-size: 20px; }
.modal .field { margin-top: 14px; }
.text-input {
  width: 100%; height: 42px; padding: 0 12px; outline: 0;
  background: #070b22; border: 1px solid var(--line-2); border-radius: 10px;
}
.text-input:focus { border-color: var(--accent); }
.modal .at-input { margin-bottom: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.dropzone {
  position: relative; display: block; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: 12px; background: #070b22;
  padding: 22px 16px; text-align: center;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dz-empty svg { width: 26px; height: 26px; color: var(--accent); }
.dz-empty small { color: var(--muted); font-size: 12.5px; }
.dropzone.has-file { padding: 10px; text-align: left; }
.dropzone.has-file .dz-empty { display: none; }
.dz-file { display: flex; align-items: center; gap: 12px; }
.dz-file img, .dz-file video { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.dz-name { display: flex; flex-direction: column; min-width: 0; }
.dz-name strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-name small { color: var(--muted); font-size: 12.5px; }

.progress { height: 6px; border-radius: 3px; background: #070b22; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.form-error { margin: 10px 0 0; color: #ff8a9a; font-size: 13.5px; min-height: 1em; }
.form-error:empty { display: none; }

.sent { text-align: center; padding: 10px 4px 0; }
.sent h2 { margin: 12px 0 4px; font-size: 20px; }
.sent p { margin: 0; color: var(--muted); }
.sent-icon {
  width: 56px; height: 56px; margin: 6px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(127, 220, 255, .12); color: var(--accent);
}
.sent-icon svg { width: 26px; height: 26px; }
.sent .ed-foot { justify-content: center; }
.sent .ed-foot .spacer { display: none; }

/* studio: "Share to Data Bank" */
.share-row { margin-top: 12px; }
.share-row .secondary { width: 100%; }
.share-preview { display: flex; justify-content: center; margin: 4px 0 4px; }
.share-preview img { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; background: #000; }
.share-preview.pfp img { border-radius: 50%; }
.modal .seg.two { margin: 12px 0 14px; }

/* admin */
.admin-login { max-width: 380px; margin: 8vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.admin-login h1 { margin: 0 0 4px; font-size: 22px; }
.admin-login p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.admin-login .primary { width: 100%; margin-top: 14px; }
.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-bar .bank-tabs { margin: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.admin-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.admin-card .card-media img, .admin-card .card-media video { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: #000; }
.admin-card .post-full { width: auto; border: 0; border-radius: 0; padding: 14px; background: #070b22; }
.admin-card .post-full .post-text { font-size: 14px; max-height: 220px; overflow-y: auto; }
.admin-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.admin-body .text-input { height: 36px; font-size: 14px; }
.admin-body .at-input { margin: 0; }
.admin-body .at-input input { height: 34px; font-size: 14px; }
.admin-info { color: var(--muted); font-size: 12.5px; }
.admin-actions { display: flex; gap: 8px; }
.admin-actions button { flex: 1; }
.danger { color: #ff8a9a !important; }
.admin-add { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.admin-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.admin-panel h2 { margin: 0 0 4px; font-size: 17px; }
.admin-panel > p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.admin-panel .primary { margin-top: 12px; }
.queue { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.queue:empty { display: none; }
.queue-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.queue-row img, .queue-row .no-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: #000; }
.queue-row .text-input { height: 34px; font-size: 14px; }
.queue-row small { color: var(--muted); font-size: 12px; }
.queue-row small.err { color: #ff8a9a; }
.queue-row small.ok { color: var(--accent); }

/* bank page: the "Quantum Core" 3D hero, a ticker of what's inside, holographic cards */
body.bank-page { background: #02030c; }
body.bank-page::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 80% 10%, rgba(155, 107, 255, .09), transparent 70%),
    radial-gradient(800px 600px at 10% 70%, rgba(61, 123, 255, .09), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 33% 72%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 58% 34%, #bfe9ff, transparent), radial-gradient(1px 1px at 76% 61%, #fff7, transparent),
    radial-gradient(1px 1px at 91% 12%, #fff5, transparent), radial-gradient(1.5px 1.5px at 44% 90%, #d9c8ff, transparent);
  background-size: 100% 100%, 100% 100%, 340px 340px, 340px 340px, 340px 340px, 340px 340px, 340px 340px, 340px 340px;
}
.bank-page .site-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6; border-bottom: 0;
  background: linear-gradient(rgba(2, 3, 12, .8), rgba(2, 3, 12, 0));
}

/* hero */
.hero3d {
  position: relative; overflow: hidden; height: max(620px, min(100svh, 960px));
  background: #02030c url(/tools/assets/qi-header-1500.webp) 72% 30% / cover no-repeat;   /* shown until (or without) WebGL */
}
.hero3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.4s ease; touch-action: pan-y; }
.hero3d.ready canvas { opacity: 1; }
.h3-shade {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(90deg, rgba(2, 3, 12, .86) 0%, rgba(2, 3, 12, .5) 30%, rgba(2, 3, 12, 0) 52%),
    linear-gradient(0deg, #02030c 0%, rgba(2, 3, 12, 0) 20%);
}
.h3-copy {
  position: absolute; z-index: 2; top: 50%; transform: translateY(-44%);
  left: max(clamp(16px, 4vw, 48px), calc((100% - 1240px) / 2 + 48px)); width: min(560px, 44%);
  pointer-events: none;
}
.h3-copy a, .h3-copy button { pointer-events: auto; }
.h3-copy .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--accent);
}
.h3-copy .eyebrow::before { content: ''; width: 26px; height: 1px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.h3-copy h1 { margin: 16px 0 0; font-size: clamp(56px, 6.6vw, 108px); line-height: .86; letter-spacing: -.04em; text-transform: uppercase; }
.h3-copy h1 span { display: block; }
.h3-copy h1 .l1 { color: #fff; text-shadow: 0 0 60px rgba(127, 220, 255, .4); }
.h3-copy h1 .l2 {
  background: linear-gradient(90deg, #7fdcff 0%, #a77bff 50%, #ffb36b 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 28px rgba(140, 120, 255, .4));
}
.h3-copy p { margin: 20px 0 26px; max-width: 42ch; color: #b9c4f0; font-size: 17.5px; }
.h3-copy .primary { box-shadow: 0 0 30px rgba(127, 220, 255, .35); }
.h3-copy .secondary { background: rgba(10, 15, 44, .6); backdrop-filter: blur(8px); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stat {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; color: #b6c1ee;
  background: rgba(10, 15, 44, .55); border: 1px solid rgba(127, 220, 255, .22); backdrop-filter: blur(8px);
}
.stat b { color: #fff; font-size: 17px; }
.stat em { font-style: normal; }
.h3-hint {
  position: absolute; z-index: 2; right: clamp(16px, 4vw, 48px); bottom: 30px; margin: 0;
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; letter-spacing: .03em; pointer-events: none;
}
.h3-hint svg { width: 16px; height: 16px; }
.h3-scroll {
  position: absolute; z-index: 2; left: 50%; bottom: 22px; margin-left: -21px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); border: 1px solid rgba(127, 220, 255, .3);
  background: rgba(7, 11, 34, .5); backdrop-filter: blur(6px); animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(6px); } }
@media (max-width: 760px) {
  .hero3d { height: max(640px, min(100svh, 820px)); background-position: 50% 0; background-size: auto 55%; }
  .h3-shade { background: linear-gradient(0deg, #02030c 0%, rgba(2, 3, 12, .9) 36%, rgba(2, 3, 12, 0) 60%); }
  .h3-copy { top: auto; bottom: 64px; transform: none; left: 16px; right: 16px; width: auto; }
  .h3-copy h1 { font-size: clamp(46px, 14vw, 64px); }
  .h3-copy p { font-size: 15.5px; margin: 14px 0 20px; }
  .stats { margin-top: 18px; }
  .h3-hint { display: none; }
  .h3-scroll { bottom: 12px; width: 36px; height: 36px; margin-left: -18px; }
}
@media (prefers-reduced-motion: reduce) { .h3-scroll { animation: none; } }

/* ticker */
.ticker {
  position: relative; overflow: hidden; padding: 15px 0;
  border-block: 1px solid rgba(127, 220, 255, .14); background: rgba(7, 11, 34, .55);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track { display: flex; width: max-content; animation: tick 70s linear infinite; }
.ticker-track span { display: inline-flex; align-items: center; gap: 22px; padding-right: 22px; white-space: nowrap; font-size: 19px; font-weight: 700; letter-spacing: .08em; color: #c9d3ff; }
.ticker-track span:nth-child(3n + 2) { color: var(--accent); }
.ticker-track span:nth-child(3n) { color: #b48bff; }
.ticker-track span::after { content: '✦'; color: #ffb36b; font-size: 13px; }
@keyframes tick { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* feed */
.bank-page .bank { padding-top: 34px; }
.bank-page .bank-tabs { background: rgba(7, 11, 34, .7); border-color: rgba(61, 123, 255, .25); border-radius: 999px; }
.bank-page .bank-tabs button { border-radius: 999px; }
.bank-page .bank-tabs button[aria-selected="true"] { background: linear-gradient(90deg, #2a4dd6, #6a45d8); color: #fff; box-shadow: 0 0 22px rgba(91, 110, 255, .5); }
.bank-page .card {
  position: relative; border: 1px solid transparent; border-radius: 16px;
  background: linear-gradient(#0a0f2c, #0a0f2c) padding-box,
    linear-gradient(150deg, rgba(127, 220, 255, .45), rgba(155, 107, 255, .2) 45%, rgba(255, 179, 107, .3)) border-box;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s;
  will-change: transform;
}
.bank-page .card.fly { animation-fill-mode: backwards; }
.bank-page .card:hover { transform: none; }
.bank-page .card.holo { box-shadow: 0 22px 60px -18px rgba(110, 120, 255, .75); transition: box-shadow .3s; }
.bank-page .card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 42%),
    linear-gradient(115deg, rgba(0, 0, 0, 0) 25%, rgba(127, 220, 255, .22) 40%, rgba(180, 139, 255, .22) 50%, rgba(255, 179, 107, .18) 60%, rgba(0, 0, 0, 0) 75%);
  background-size: 100% 100%, 260% 260%;
  background-position: center, var(--mx, 50%) var(--my, 50%);
  mix-blend-mode: screen;
}
.bank-page .card.holo::after { opacity: 1; }
.bank-page .card-media { overflow: hidden; border-radius: 15px 15px 0 0; }
