/* =========================================================
   Tallyguidesocilsspry: Futuristic Dark AI Lab Stylesheet
   ========================================================= */
:root {
  --primary: #7C3AED;
  --secondary: #2563EB;
  --accent: #22D3EE;
  --electric: #A855F7;
  --bg: #050816;
  --surface: #0B1024;
  --text: #F8FAFC;
  --muted: #94A3B8;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; overflow-x: hidden; }
::selection { background: rgba(124, 58, 237, .55); color: #fff; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--primary), var(--secondary)); border-radius: 10px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; padding: .6rem 1rem; border-radius: .75rem; background: var(--primary); color: #fff; }
.skip-link:focus { left: 8px; }

/* ---------- Images: loading state & fallback ---------- */
img { max-width: 100%; }
main img:not(.img-fallback),
.tool-card img,
.bento-tile img {
  background-color: #0B1024;
  background-image: linear-gradient(135deg, rgba(124, 58, 237, .22), rgba(11, 16, 36, .6) 55%, rgba(34, 211, 238, .14));
}
img.img-fallback { object-fit: cover; background: #0B1024; }
#lbImg { min-width: min(320px, 80vw); min-height: 200px; }

/* ---------- Background textures ---------- */
.lab-grid-background {
  background-image:
    linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 56px 56px;
}
.gradient-orb { position: absolute; border-radius: 999px; filter: blur(90px); opacity: .45; pointer-events: none; animation: orbMorph 18s ease-in-out infinite; }
.orb-violet { width: 520px; height: 520px; background: radial-gradient(circle, #7C3AED, transparent 70%); top: -160px; left: -120px; }
.orb-cyan { width: 460px; height: 460px; background: radial-gradient(circle, #22D3EE, transparent 70%); bottom: -200px; right: -120px; animation-delay: -6s; opacity: .3; }
.orb-blue { width: 380px; height: 380px; background: radial-gradient(circle, #2563EB, transparent 70%); top: 30%; right: 30%; animation-delay: -10s; opacity: .25; }
@keyframes orbMorph {
  0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50% 45% 55% 50%; }
  33% { transform: translate(60px, 40px) scale(1.12); border-radius: 40% 60% 45% 55%; }
  66% { transform: translate(-40px, 20px) scale(.92); border-radius: 55% 40% 60% 45%; }
}

/* ---------- Glass & borders ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.glass-strong { background: rgba(11, 16, 36, .78); border: 1px solid rgba(255, 255, 255, .09); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }

@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.animated-border { position: relative; isolation: isolate; }
.animated-border::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--angle), transparent 0 55%, #22D3EE 70%, #A855F7 80%, #7C3AED 88%, transparent 95%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinBorder 6s linear infinite;
}
@keyframes spinBorder { to { --angle: 360deg; } }

/* ---------- Typography ---------- */
.text-gradient-animated {
  background: linear-gradient(90deg, #22D3EE, #A855F7, #7C3AED, #2563EB, #22D3EE);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradientShift 8s linear infinite;
}
@keyframes gradientShift { to { background-position: 300% 0; } }
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; padding: .45rem .9rem; border-radius: 999px; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #C4B5FD; background: rgba(124, 58, 237, .12); border: 1px solid rgba(168, 85, 247, .3); }
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 0 rgba(34, 211, 238, .7); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 70% { box-shadow: 0 0 0 10px rgba(34, 211, 238, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); } }
.section-kicker { font-family: "Space Grotesk", sans-serif; font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }

/* ---------- Navigation ---------- */
.nav-link { padding: .5rem .95rem; border-radius: 999px; color: var(--muted); transition: .25s; }
.nav-link:hover, .nav-link.is-active { color: var(--text); background: rgba(255, 255, 255, .06); }
.mobile-link { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; border-radius: 1rem; color: var(--text); background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .06); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.15rem; border-radius: 999px; font-weight: 600; font-size: .875rem; line-height: 1.1;
  transition: transform .25s, box-shadow .25s, background .25s, border-color .25s; white-space: nowrap;
}
.btn-primary { color: #fff; background: linear-gradient(135deg, #7C3AED, #2563EB); box-shadow: 0 12px 30px -12px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(34, 211, 238, .55); }
.btn-ghost { color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .14); }
.btn-ghost:hover { border-color: rgba(34, 211, 238, .6); background: rgba(34, 211, 238, .08); transform: translateY(-2px); }

/* ---------- Pills, badges, metrics ---------- */
.pill { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1rem; border-radius: 999px; font-size: .85rem; color: var(--muted); background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .09); transition: .25s; }
.pill:hover { color: var(--text); border-color: rgba(168, 85, 247, .5); }
.pill.is-active { color: #fff; background: linear-gradient(135deg, rgba(124, 58, 237, .45), rgba(37, 99, 235, .35)); border-color: rgba(168, 85, 247, .7); box-shadow: 0 0 24px -6px rgba(168, 85, 247, .6); }
.pill-count { font-size: .7rem; padding: .1rem .45rem; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.pill-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: #E0E7FF; background: rgba(5, 8, 22, .65); border: 1px solid rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.score-badge { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1rem; font-family: "Space Grotesk", sans-serif; font-weight: 700; color: #fff; background: linear-gradient(135deg, rgba(124, 58, 237, .9), rgba(34, 211, 238, .75)); box-shadow: 0 0 30px -6px rgba(34, 211, 238, .7); }
.metric { font-size: .72rem; padding: .3rem .65rem; border-radius: .6rem; color: #CBD5E1; background: rgba(148, 163, 184, .08); border: 1px solid rgba(148, 163, 184, .14); }

/* ---------- Tool card ---------- */
.tool-card {
  position: relative; display: flex; flex-direction: column; border-radius: 1.5rem; overflow: hidden;
  background: linear-gradient(180deg, rgba(11, 16, 36, .92), rgba(5, 8, 22, .92));
  border: 1px solid rgba(255, 255, 255, .07); transition: transform .35s, border-color .35s, box-shadow .35s;
}
.tool-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(380px circle at var(--x, 50%) var(--y, 0%), rgba(124, 58, 237, .18), transparent 60%);
}
.tool-card:hover { transform: translateY(-6px); border-color: rgba(168, 85, 247, .45); box-shadow: 0 30px 60px -30px rgba(124, 58, 237, .7); }
.tool-card:hover::after { opacity: 1; }
.tool-card > * { position: relative; z-index: 1; }

/* ---------- Hero effects ---------- */
.hero-spotlight { background: radial-gradient(620px circle at var(--mx, 60%) var(--my, 35%), rgba(124, 58, 237, .2), rgba(34, 211, 238, .06) 35%, transparent 65%); }
.scanlines::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px); }
.scan-beam { position: absolute; left: 0; right: 0; height: 140px; top: -140px; pointer-events: none; background: linear-gradient(to bottom, transparent, rgba(34, 211, 238, .07), transparent); animation: scanMove 7s linear infinite; }
@keyframes scanMove { to { transform: translateY(1100px); } }

/* AI CORE */
.ai-core { position: relative; width: min(400px, 78vw); aspect-ratio: 1; perspective: 900px; }
.core-ring { position: absolute; border-radius: 50%; }
.core-ring.ring-a { inset: 0; border: 1px dashed rgba(34, 211, 238, .35); animation: spin 40s linear infinite; }
.core-ring.ring-b { inset: 9%; border: 1px solid rgba(168, 85, 247, .3); border-top-color: rgba(34, 211, 238, .9); animation: spin 12s linear infinite reverse; }
.core-ring.ring-c { inset: 20%; border: 2px solid transparent; border-left-color: rgba(124, 58, 237, .9); border-right-color: rgba(37, 99, 235, .8); animation: spin 7s linear infinite; }
.neural-sphere { position: absolute; inset: 24%; transform-style: preserve-3d; animation: sphereSpin 18s linear infinite; }
.neural-sphere span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(34, 211, 238, .32); }
.neural-sphere span:nth-child(1) { transform: rotateY(0deg); }
.neural-sphere span:nth-child(2) { transform: rotateY(30deg); }
.neural-sphere span:nth-child(3) { transform: rotateY(60deg); }
.neural-sphere span:nth-child(4) { transform: rotateY(90deg); }
.neural-sphere span:nth-child(5) { transform: rotateY(120deg); }
.neural-sphere span:nth-child(6) { transform: rotateY(150deg); }
.neural-sphere span:nth-child(7) { transform: rotateX(90deg); border-color: rgba(168, 85, 247, .45); }
.neural-sphere span:nth-child(8) { transform: rotateX(90deg) translateZ(40px) scale(.8); border-color: rgba(168, 85, 247, .3); }
.neural-sphere span:nth-child(9) { transform: rotateX(90deg) translateZ(-40px) scale(.8); border-color: rgba(168, 85, 247, .3); }
.core-nucleus {
  position: absolute; inset: 36%; border-radius: 50%; display: grid; place-content: center; text-align: center;
  font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: .2em; font-size: .8rem; line-height: 1.3;
  background: radial-gradient(circle at 35% 30%, #A855F7, #7C3AED 45%, #1E1B4B 100%);
  box-shadow: 0 0 60px 10px rgba(124, 58, 237, .55), 0 0 120px 30px rgba(34, 211, 238, .18), inset 0 0 30px rgba(34, 211, 238, .5);
  animation: corePulse 3.2s ease-in-out infinite;
}
@keyframes corePulse { 50% { box-shadow: 0 0 80px 18px rgba(168, 85, 247, .65), 0 0 160px 40px rgba(34, 211, 238, .25), inset 0 0 40px rgba(34, 211, 238, .7); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sphereSpin { from { transform: rotateX(18deg) rotateY(0); } to { transform: rotateX(18deg) rotateY(360deg); } }

/* Floating UI */
.float-card { position: absolute; z-index: 5; animation: floatY 6s ease-in-out infinite; }
.float-card.delay-1 { animation-delay: -1.5s; }
.float-card.delay-2 { animation-delay: -3s; }
.float-card.delay-3 { animation-delay: -4.5s; }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* 3D cube */
.cube3d { position: absolute; width: 46px; height: 46px; transform-style: preserve-3d; animation: cubeSpin 16s linear infinite; }
.cube3d i { position: absolute; inset: 0; border: 1px solid rgba(168, 85, 247, .55); background: rgba(124, 58, 237, .08); box-shadow: inset 0 0 14px rgba(34, 211, 238, .25); }
.cube3d i:nth-child(1) { transform: translateZ(23px); }
.cube3d i:nth-child(2) { transform: rotateY(180deg) translateZ(23px); }
.cube3d i:nth-child(3) { transform: rotateY(90deg) translateZ(23px); }
.cube3d i:nth-child(4) { transform: rotateY(-90deg) translateZ(23px); }
.cube3d i:nth-child(5) { transform: rotateX(90deg) translateZ(23px); }
.cube3d i:nth-child(6) { transform: rotateX(-90deg) translateZ(23px); }
.cube3d.cube-sm { width: 28px; height: 28px; animation-duration: 11s; }
.cube3d.cube-sm i:nth-child(1) { transform: translateZ(14px); }
.cube3d.cube-sm i:nth-child(2) { transform: rotateY(180deg) translateZ(14px); }
.cube3d.cube-sm i:nth-child(3) { transform: rotateY(90deg) translateZ(14px); }
.cube3d.cube-sm i:nth-child(4) { transform: rotateY(-90deg) translateZ(14px); }
.cube3d.cube-sm i:nth-child(5) { transform: rotateX(90deg) translateZ(14px); }
.cube3d.cube-sm i:nth-child(6) { transform: rotateX(-90deg) translateZ(14px); }
@keyframes cubeSpin { from { transform: rotateX(0) rotateY(0); } to { transform: rotateX(360deg) rotateY(720deg); } }

/* ---------- Bento ---------- */
.bento-tile { position: relative; overflow: hidden; border-radius: 1.5rem; border: 1px solid rgba(255, 255, 255, .08); background: var(--surface); transition: border-color .3s, transform .3s; }
.bento-tile:hover { border-color: rgba(34, 211, 238, .5); transform: translateY(-4px); }
.bento-tile img { transition: transform .8s, opacity .4s; }
.bento-tile:hover img { transform: scale(1.06); opacity: .55; }

/* Holographic panel */
.holo-panel { position: relative; border-radius: 1.5rem; overflow: hidden; background: linear-gradient(135deg, rgba(124, 58, 237, .14), rgba(34, 211, 238, .06) 60%, rgba(37, 99, 235, .1)); border: 1px solid rgba(34, 211, 238, .2); }
.holo-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .07) 45%, transparent 60%); background-size: 250% 100%; animation: holoSweep 6s linear infinite; }
@keyframes holoSweep { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* Progress bars */
.bar-track { height: 8px; border-radius: 999px; background: rgba(148, 163, 184, .12); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7C3AED, #22D3EE); }

/* Inputs */
.lab-input { width: 100%; background: transparent; color: var(--text); outline: none; }
.lab-input::placeholder { color: #64748B; }
.lab-select { background: rgba(11, 16, 36, .9); border: 1px solid rgba(255, 255, 255, .1); color: var(--text); border-radius: 999px; padding: .6rem 1rem; font-size: .875rem; }
.search-shell:focus-within { border-color: rgba(34, 211, 238, .6); box-shadow: 0 0 0 4px rgba(34, 211, 238, .12), 0 20px 50px -20px rgba(124, 58, 237, .8); }

/* FAQ */
details.faq summary { list-style: none; cursor: pointer; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq[open] .faq-icon { transform: rotate(45deg); }
.faq-icon { transition: transform .3s; }

/* Legal prose */
.legal-prose h2 { font-family: "Space Grotesk", sans-serif; font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 .75rem; color: var(--text); }
.legal-prose h3 { font-weight: 600; margin: 1.5rem 0 .5rem; color: #E2E8F0; }
.legal-prose p, .legal-prose li { color: #CBD5E1; line-height: 1.8; }
.legal-prose p { margin-bottom: 1rem; }
.legal-prose ul { list-style: disc; padding-left: 1.4rem; margin-bottom: 1rem; }
.legal-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Guide article */
.guide-article p { color: #CBD5E1; line-height: 1.85; margin-bottom: 1.1rem; }
.guide-article h3 { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.25rem; margin: 1.6rem 0 .6rem; }
.toc-link { display: block; padding: .5rem .8rem; border-radius: .75rem; color: var(--muted); font-size: .9rem; transition: .2s; }
.toc-link:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

/* Cookie banner */
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 90; max-width: 860px; margin: 0 auto; animation: cookieIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes cookieIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(5, 8, 22, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.lightbox.hidden { display: none; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s, transform .8s; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}