/* Chemistry theme for the public site */
body.chem {
  --primary: #0891b2;
  --primary-600: #0e7490;
  --primary-soft: #e0f6fb;
  --accent: #7c3aed;
  --lime: #84cc16;
  --ink: #06121f;
}
:root[data-theme="dark"] body.chem {
  --primary: #22d3ee;
  --primary-600: #0891b2;
  --primary-soft: #0c2a36;
  --accent: #a78bfa;
  --lime: #a3e635;
}

/* ---------- Nav ---------- */
.chem .site-nav .links { display: flex; gap: .3rem; }
.chem .site-nav .links a { color: var(--muted); font-weight: 600; font-size: .92rem; padding: .5rem .85rem; border-radius: 10px; }
.chem .site-nav .links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
@media (max-width: 760px) { .chem .site-nav .links { display: none; } }

/* ---------- Hero ---------- */
.lab-hero {
  position: relative; overflow: hidden; isolation: isolate; color: #eaf6ff; text-align: center;
  padding: clamp(4rem, 9vw, 7.5rem) 0 clamp(5rem, 9vw, 7rem);
  background:
    radial-gradient(60% 70% at 15% 10%, rgba(34, 211, 238, .28), transparent 65%),
    radial-gradient(55% 70% at 88% 0%, rgba(124, 58, 237, .38), transparent 65%),
    radial-gradient(50% 60% at 60% 110%, rgba(132, 204, 22, .20), transparent 65%),
    linear-gradient(180deg, #06121f, #0a1b33);
}
.lab-hero canvas.mol { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.lab-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .9rem; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); font-size: .82rem; font-weight: 600;
  backdrop-filter: blur(8px); margin-bottom: 1.4rem;
}
.lab-hero .eyebrow i { color: var(--lime); }
.lab-hero h1 { font-size: clamp(2.2rem, 6.2vw, 4.4rem); font-weight: 800; letter-spacing: -.035em; margin-bottom: 1.1rem; }
.grad { background: linear-gradient(95deg, #22d3ee, #a78bfa 55%, #a3e635); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.lab-hero p.lead { max-width: 720px; margin: 0 auto; color: #b9d3e6; font-size: clamp(1rem, 2vw, 1.15rem); }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
.btn-glow { background: linear-gradient(135deg, #06b6d4, #7c3aed); color: #fff; box-shadow: 0 10px 30px -8px rgba(124, 58, 237, .7); padding: .85rem 1.4rem; }
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -8px rgba(124, 58, 237, .85); }
.btn-outline-light { background: rgba(255,255,255,.07); color: #fff; border-color: rgba(255,255,255,.22); padding: .85rem 1.4rem; backdrop-filter: blur(6px); }
.btn-outline-light:hover { background: rgba(255,255,255,.14); }

.hero-stats { display: flex; justify-content: center; gap: clamp(1.2rem, 4vw, 3rem); margin-top: 3rem; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; }
.hero-stats span { color: #94b6cf; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; }

/* floating element tiles */
.tiles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.tile {
  position: absolute; width: 74px; height: 74px; border-radius: 16px; padding: 7px 9px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(6px);
  text-align: left; color: #fff; animation: float 7s ease-in-out infinite;
  box-shadow: 0 14px 40px -14px rgba(0,0,0,.6);
}
.tile small { font-size: .62rem; opacity: .7; display: block; }
.tile b { font-size: 1.75rem; line-height: 1; display: block; margin-top: .25rem; }
.tile em { font-style: normal; font-size: .55rem; opacity: .65; display: block; }
.tile.t1 { left: 5%; top: 18%; --c: #22d3ee; animation-delay: -1s; }
.tile.t2 { right: 6%; top: 14%; --c: #a78bfa; animation-delay: -3s; }
.tile.t3 { left: 12%; bottom: 14%; --c: #a3e635; animation-delay: -5s; }
.tile.t4 { right: 11%; bottom: 18%; --c: #fb7185; animation-delay: -2s; }
.tile { border-top: 3px solid var(--c); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-18px) rotate(3deg); } }
@media (max-width: 900px) { .tile { display: none; } }

/* flask with bubbles */
.flask-wrap { position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%); width: 100%; height: 70px; z-index: -1; overflow: hidden; pointer-events: none; }
.wave { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; animation: wave 14s linear infinite; opacity: .55; }
.wave.w2 { animation-duration: 22s; opacity: .35; animation-direction: reverse; }
@keyframes wave { to { transform: translateX(-50%); } }

/* ---------- Formula marquee ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--border); background: var(--surface); }
.marquee-track { display: flex; gap: 3rem; width: max-content; padding: 1rem 0; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { font-weight: 700; font-size: 1.15rem; color: var(--muted); white-space: nowrap; }
.marquee-track span:nth-child(3n) { color: var(--primary); }
.marquee-track span:nth-child(3n+1) { color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Learning levels ---------- */
.eyebrow-dark { display: inline-block; color: var(--primary); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; margin-bottom: .6rem; }
.center { text-align: center; max-width: 680px; margin: 0 auto 2.6rem; }
.center h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; }
.center p { color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4rem; }
.level { padding: 1.8rem; position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s; }
.level:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.level::after { content: attr(data-n); position: absolute; right: -.5rem; top: -1.4rem; font-size: 7rem; font-weight: 800; color: var(--primary); opacity: .07; }
.level .orb { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.3rem; margin-bottom: 1.1rem; background: var(--g); box-shadow: 0 10px 24px -8px var(--g1); position: relative; }
.level .orb::before, .level .orb::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px solid var(--g1); inset: -8px; opacity: .5; animation: orbit 5s linear infinite; }
.level .orb::after { inset: -16px; opacity: .25; animation-duration: 8s; animation-direction: reverse; }
@keyframes orbit { to { transform: rotate(360deg); } }
.level h3 { font-size: 1.2rem; }
.level p { color: var(--muted); font-size: .95rem; margin: 0; }
.l1 { --g: linear-gradient(135deg, #06b6d4, #3b82f6); --g1: #06b6d4; }
.l2 { --g: linear-gradient(135deg, #8b5cf6, #d946ef); --g1: #8b5cf6; }
.l3 { --g: linear-gradient(135deg, #84cc16, #10b981); --g1: #84cc16; }

/* ---------- Articles ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem; }
.filter { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: .45rem .95rem; border-radius: 999px; font: 600 .84rem var(--font); cursor: pointer; transition: all .15s; }
.filter:hover { color: var(--text); border-color: var(--primary); }
.filter.on { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }

.chem .article-card { position: relative; overflow: hidden; padding: 1.6rem; }
.chem .article-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, hsl(var(--h) 85% 55%), hsl(calc(var(--h) + 60) 85% 60%));
}
.chem .article-card::after {
  content: ""; position: absolute; width: 180px; height: 180px; right: -60px; bottom: -70px; border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--h) 85% 60% / .22), transparent 70%); transition: transform .5s;
}
.chem .article-card:hover::after { transform: scale(1.6); }
.el {
  width: 64px; height: 64px; border-radius: 16px; padding: 6px 8px; margin-bottom: 1.1rem; position: relative;
  color: #fff; background: linear-gradient(145deg, hsl(var(--h) 80% 52%), hsl(calc(var(--h) + 50) 80% 45%));
  box-shadow: 0 12px 24px -10px hsl(var(--h) 80% 45%);
}
.el small { font-size: .58rem; opacity: .8; display: block; line-height: 1; }
.el b { font-size: 1.6rem; line-height: 1; display: block; margin-top: .3rem; letter-spacing: -.03em; }
.chem .article-card:hover .el { animation: wiggle .6s ease; }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.chem .article-card .meta { position: relative; z-index: 1; }
.chem .article-card .go { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--primary); }
.chem .article-card:hover .go i { transform: translateX(4px); }
.chem .article-card .go i { transition: transform .2s; }

/* ---------- Detail hero ---------- */
.lab-hero.compact { text-align: left; padding: clamp(2.8rem, 6vw, 4.5rem) 0 clamp(3rem, 6vw, 4.5rem); }
.lab-hero.compact h1 { font-size: clamp(1.8rem, 4.6vw, 3rem); }
.lab-hero.compact .crumbs { color: #94b6cf; }
.lab-hero.compact .crumbs a { color: #b9d3e6; }
.detail-head { display: flex; align-items: center; gap: 1.4rem; }
.detail-head .el { width: 84px; height: 84px; flex: none; margin: 0; }
.detail-head .el b { font-size: 2.2rem; }
@media (max-width: 560px) { .detail-head { flex-direction: column; align-items: flex-start; } }
.lab-hero .chip { background: rgba(255,255,255,.1); color: #d6ecfb; border: 1px solid rgba(255,255,255,.14); }

/* ---------- Footer ---------- */
.chem .site-footer { background: #06121f; color: #94b6cf; border-top: 0; padding: 2.6rem 0; }
.chem .site-footer b { color: #fff; }
.chem .site-footer .formula { letter-spacing: .1em; color: #22d3ee; font-weight: 700; margin-bottom: .4rem; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .tile, .grad, .marquee-track, .wave, .level .orb::before, .level .orb::after { animation: none !important; }
}

/* ---------- Comments ---------- */
.cm { padding: clamp(1.1rem, 3vw, 1.8rem); }
.cm-title h2 { font-size: 1.3rem; display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.cm-login { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.2rem 1.3rem; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); border: 1px solid var(--border); margin-bottom: 1.4rem; }
.cm-login b { font-size: 1.05rem; }
.cm-login p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.cm-google { background: #fff; color: #1f2937; border: 1px solid #dadce0; box-shadow: var(--shadow-sm); padding: .75rem 1.2rem; }
.cm-google:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.cm-userbar { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.cm-who { flex: 1; min-width: 0; line-height: 1.25; }
.cm-who small { color: var(--muted); display: block; }
.cm-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.cm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-form { margin-bottom: 1.6rem; }
.cm-formrow { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.cm-reply { margin: .7rem 0 0; }
.cm-reply .textarea { min-height: 0; }
.textarea { resize: vertical; min-height: 84px; }
.cm-empty { text-align: center; color: var(--muted); padding: 1.6rem 0; margin: 0; }
.cm-item { display: flex; gap: .85rem; padding: .9rem 0; }
.cm-list > .cm-item { border-top: 1px solid var(--border); }
.cm-list > .cm-item:first-child { border-top: 0; }
.cm-main { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.cm-head time { color: var(--muted); font-size: .8rem; }
.cm-body { margin: .25rem 0 .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.cm-act { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; color: var(--muted); font: 600 .82rem var(--font); padding: .3rem .6rem; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.cm-act:hover { background: var(--surface-2); color: var(--text); }
.cm-act.on { color: #e11d48; }
.cm-act.on i { animation: pop .35s ease; }
.cm-act.danger:hover { color: var(--danger); background: var(--danger-soft); }
@keyframes pop { 40% { transform: scale(1.5); } }
.cm-toggle { border: 0; background: none; color: var(--primary); font: 700 .82rem var(--font); cursor: pointer; padding: .3rem 0; margin-top: .2rem; }
.cm-replies { margin-top: .3rem; padding-left: .9rem; border-left: 2px solid var(--border); }
.cm-replies.flat { padding-left: 0; border-left: 0; }
.cm-replies .cm-avatar { width: 32px; height: 32px; font-size: .85rem; }
@media (max-width: 560px) { .cm-replies { padding-left: .6rem; } .cm-login .btn { width: 100%; } }
