/* Soren Laboratory · Chemistry — what lab.css does not have: the periodic table's tiles, the readout in
   the gap above the transition metals, the dock under the table, and the atom panel's orbital diagram. Loaded after lab.css, and only by chemistry pages. */
body.chem {
  --st-solid:#9db8c9; --st-liquid:#5fe6ff; --st-gas:#ffb86b; --st-unknown:#56707c;
  --cell:60px; --t-top:78px;
}

/* ── Two views on one page: the table, and one atom on the stage ───────────────────── */
/* Table view: the top bar is one row (back, title, depth at the right) so the table gets the height. */
body.ptable-page:not(.atom) .top { right:var(--pad); top:20px; flex-direction:row; align-items:center; gap:18px; }
body.ptable-page:not(.atom) .top h1 { font-size:21px; white-space:nowrap; }
body.ptable-page:not(.atom) #lensSeg { margin:0 auto; }
body.ptable-page #lensSeg button { padding:7px 13px; }
body.atom #lensSeg { display:none; }
@media (max-width: 1240px) { body.ptable-page:not(.atom) .top h1 { display:none; } }
body.ptable-page:not(.atom) #atomTools, body.ptable-page:not(.atom) #scale { opacity:0; pointer-events:none; }
body.ptable-page #scale { transition:opacity .4s; }
body.ptable-page #scale.none .bar, body.ptable-page #scale.none .lbl { display:none; }
body.ptable-page:not(.atom) #stage canvas { cursor:default; }

/* ── The table ─────────────────────────────────────────────────────────────────────── */
.ptable { position:fixed; z-index:3; left:50%; top:var(--t-top); width:calc(var(--cell) * 18); height:calc(var(--cell) * 9.35); margin-left:calc(var(--cell) * -9);
  display:grid; grid-template-columns:repeat(18, 1fr); grid-template-rows:repeat(7, 1fr) .35fr repeat(2, 1fr); gap:calc(var(--cell) * .05);
  pointer-events:none; transition:opacity .45s, transform .7s cubic-bezier(.2,.7,.2,1), visibility 0s; }
body.atom .ptable { opacity:0; transform:scale(.94); visibility:hidden; transition:opacity .35s, transform .6s cubic-bezier(.2,.7,.2,1), visibility 0s .4s; }

.el { --c:#6b8794; pointer-events:auto; position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:0; min-height:0;
  grid-column:var(--x); grid-row:var(--y); border-radius:calc(var(--cell) * .15);
  border:1px solid color-mix(in srgb, var(--c) 42%, transparent); background:color-mix(in srgb, var(--c) 12%, rgba(3,14,20,.74));
  color:color-mix(in srgb, var(--c) 58%, #fff); box-shadow:inset 0 0 calc(var(--cell) * .28) color-mix(in srgb, var(--c) 9%, transparent);
  transition:background .45s, border-color .45s, color .45s, box-shadow .45s, opacity .3s, transform .18s;
  animation:elIn .55s cubic-bezier(.2,.7,.2,1) backwards; animation-delay:calc((var(--x) + var(--y) * 1.6) * 14ms); }
/* Once the tiles have arrived the entrance is switched off, so a later animation cannot replay it. */
.ptable.in .el { animation:none; }
.ptable.in .el.flip { animation:elFlip .42s cubic-bezier(.2,.7,.2,1); }
@keyframes elIn { from { opacity:0; transform:translateY(10px) scale(.92); } }
@keyframes elFlip { 0% { transform:scale(1); filter:brightness(1); } 35% { transform:scale(1.12); filter:brightness(1.9); } 100% { transform:scale(1); filter:brightness(1); } }
.el i { position:absolute; top:calc(var(--cell) * .075); left:calc(var(--cell) * .1); font-style:normal; font-size:calc(var(--cell) * .165); font-weight:500; line-height:1; color:var(--ink-soft); font-variant-numeric:tabular-nums; }
.el em { position:absolute; top:calc(var(--cell) * .08); right:calc(var(--cell) * .09); font-style:normal; font-size:calc(var(--cell) * .13); line-height:1; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
.el b { font-size:calc(var(--cell) * .37); font-weight:600; line-height:1; margin-top:calc(var(--cell) * .1); letter-spacing:-.01em; }
/* A long name (Rutherfordium) is set smaller so it is never cut off. --n is the name's length. */
.el span { font-size:calc(var(--cell) * .135 * min(1, 9.4 / var(--n, 8))); line-height:1.15; margin-top:calc(var(--cell) * .05); color:var(--ink-soft); max-width:96%; overflow:hidden; white-space:nowrap; }
.ptable[data-depth="1"] .el em, .ptable.tight .el em, .ptable.tight .el span { display:none; }
.ptable.tight .el b { margin-top:calc(var(--cell) * .16); }
button.el:hover, button.el:focus-visible { transform:scale(1.1); z-index:3; border-color:var(--c); background:color-mix(in srgb, var(--c) 24%, rgba(3,14,20,.82));
  box-shadow:0 0 calc(var(--cell) * .4) color-mix(in srgb, var(--c) 45%, transparent); }
.el.sel { z-index:2; border-color:#fff; background:color-mix(in srgb, var(--c) 26%, rgba(3,14,20,.82));
  box-shadow:0 0 0 1px #fff, 0 0 calc(var(--cell) * .45) color-mix(in srgb, var(--c) 60%, transparent); }
.ptable.dimming .el:not(.lit) { opacity:.2; }
/* The two cells that stand for the rows drawn below the table. */
.el.ph { border-style:dashed; background:none; box-shadow:none; color:var(--ink-faint); animation:none; }
.el.ph b { font-size:calc(var(--cell) * .17); font-weight:500; margin:0; letter-spacing:0; }

/* State lens: a liquid has a slow sheen, a gas a soft halo, an unmeasured one a dashed edge. */
.el[data-st="liquid"]::after { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  background:linear-gradient(115deg, transparent 32%, color-mix(in srgb, var(--c) 34%, transparent) 50%, transparent 68%); background-size:260% 100%; animation:sheen 3.4s linear infinite; }
@keyframes sheen { from { background-position:130% 0; } to { background-position:-130% 0; } }
.el[data-st="gas"] { border-color:color-mix(in srgb, var(--c) 30%, transparent);
  box-shadow:0 0 calc(var(--cell) * .3) color-mix(in srgb, var(--c) 20%, transparent), inset 0 0 calc(var(--cell) * .4) color-mix(in srgb, var(--c) 14%, transparent); }
.el[data-st="unknown"] { border-style:dashed; }
/* Not reached yet (a year not come, a shell not filled): the tile is an outline waiting. */
.el[data-st="off"] { background:rgba(3,14,20,.5); box-shadow:none; border-style:dashed; }
.el[data-st="off"] i, .el[data-st="off"] b, .el[data-st="off"] span { opacity:.28; }
.el[data-st="quiet"] { opacity:.5; }

/* ── The readout, in the gap above the transition metals ───────────────────────────── */
.notch { grid-column:3 / 13; grid-row:1 / 4; display:flex; align-items:center; gap:calc(var(--cell) * .32); min-width:0; min-height:0;
  padding:0 calc(var(--cell) * .2) calc(var(--cell) * .2) calc(var(--cell) * .4); pointer-events:none; }
.n-tile { --c:var(--cyan); flex:none; position:relative; width:calc(var(--cell) * 1.5); height:calc(var(--cell) * 1.8); border-radius:calc(var(--cell) * .24);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  border:1px solid color-mix(in srgb, var(--c) 55%, transparent); background:color-mix(in srgb, var(--c) 13%, rgba(3,14,20,.74)); color:color-mix(in srgb, var(--c) 50%, #fff);
  box-shadow:0 0 calc(var(--cell) * .6) color-mix(in srgb, var(--c) 22%, transparent), inset 0 0 calc(var(--cell) * .5) color-mix(in srgb, var(--c) 12%, transparent);
  transition:background .3s, border-color .3s, color .3s, box-shadow .3s; }
.n-tile i { position:absolute; top:calc(var(--cell) * .14); left:calc(var(--cell) * .17); font-style:normal; font-size:calc(var(--cell) * .24); font-weight:500; line-height:1; color:var(--ink-soft); }
.n-tile b { font-size:calc(var(--cell) * .78); font-weight:300; line-height:1; letter-spacing:-.03em; margin-top:calc(var(--cell) * .16); }
.n-tile em { font-style:normal; font-size:calc(var(--cell) * .2); color:var(--ink-soft); margin-top:calc(var(--cell) * .08); font-variant-numeric:tabular-nums; }
.n-body { flex:1; min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:7px; pointer-events:auto; }
.n-body .p-kicker { margin:0; letter-spacing:.14em; white-space:nowrap; }
.n-body h2 { font-size:calc(var(--cell) * .5); font-weight:600; letter-spacing:-.02em; line-height:1.05; margin:0; }
.n-line { font-size:13px; line-height:1.45; color:var(--ink-soft); margin:0; }
.n-line b { color:var(--ink); font-weight:500; }
.n-state { position:relative; align-self:stretch; height:6px; border-radius:3px; display:flex; margin:3px 0 4px; }
.n-state u { height:100%; opacity:.85; }
.n-state u:first-child { border-radius:3px 0 0 3px; } .n-state u:last-of-type { border-radius:0 3px 3px 0; }
.n-state s { position:absolute; top:-5px; width:2px; height:16px; margin-left:-1px; border-radius:1px; background:#fff; box-shadow:0 0 8px #fff; transition:left .12s linear; }
.n-slot { flex:none; position:relative; width:calc(var(--cell) * 2.7); height:calc(var(--cell) * 2.7); border-radius:50%; border:1px solid var(--line); pointer-events:auto;
  transition:border-color .2s, box-shadow .2s; }
.n-slot:hover, .n-slot:focus-visible { border-color:var(--cyan); box-shadow:0 0 30px rgba(95,230,255,.18), inset 0 0 30px rgba(95,230,255,.08); }
/* A family in the readout takes the whole width: no tile, no atom. */
.notch.fam .n-tile, .notch.fam .n-slot, .notch.fam .btn { display:none; }
.notch.fam .n-line { font-size:14px; max-width:62ch; }

/* ── The dock under the table: what the lens means, its legend, its controls ──────── */
.dock { z-index:5; left:50%; bottom:16px; transform:translateX(-50%); width:min(calc(var(--cell) * 18), calc(100% - 2 * var(--pad))); padding:11px 18px 12px; border-radius:18px;
  display:flex; flex-direction:column; gap:7px; background:var(--glass); border:1px solid var(--line);
  -webkit-backdrop-filter:blur(16px) saturate(1.3); backdrop-filter:blur(16px) saturate(1.3); transition:opacity .35s, transform .5s cubic-bezier(.2,.7,.2,1); }
body.atom .dock { opacity:0; pointer-events:none; transform:translate(-50%, 24px); }
.d-row { display:flex; align-items:center; gap:8px; min-height:28px; min-width:0; }
.d-blurb { font-size:13px; color:var(--ink-soft); margin:0; flex:1; min-width:0; }
.d-row.fams { justify-content:space-between; gap:2px; }
.fam { --c:var(--cyan); display:inline-flex; align-items:center; gap:7px; padding:5px 9px; border-radius:999px; font-size:12px; font-weight:500; color:var(--ink-soft);
  border:1px solid transparent; white-space:nowrap; transition:color .2s, background .2s, border-color .2s; }
.fam .sw { flex:none; width:8px; height:8px; border-radius:50%; background:var(--c); box-shadow:0 0 8px var(--c); }
.fam .sw.hollow { background:none; border:1px dashed var(--c); box-shadow:none; }
button.fam:hover, .fam.on { color:#fff; border-color:color-mix(in srgb, var(--c) 60%, transparent); background:color-mix(in srgb, var(--c) 14%, transparent); }
.fam b { font-weight:600; color:var(--ink); font-variant-numeric:tabular-nums; min-width:2ch; text-align:right; }
.temp { margin-left:auto; font-size:13px; color:var(--ink-soft); font-variant-numeric:tabular-nums; white-space:nowrap; }
.temp b { font-size:19px; font-weight:600; color:var(--ink); letter-spacing:-.01em; margin-right:2px; }
.d-row .axes button { white-space:nowrap; }
.d-counts { display:flex; align-items:center; gap:2px; flex-wrap:wrap; }
.d-label { font-size:12px; font-weight:500; color:var(--ink-soft); white-space:nowrap; font-variant-numeric:tabular-nums; }
.d-ramp { position:relative; flex:1; height:8px; border-radius:4px; margin:0 6px; background:linear-gradient(90deg, #22306b, #2a62b8, #2fb3d6, #5fe6c0, #d6f77a, #ffd166); }
.d-ramp s { position:absolute; top:-5px; width:2px; height:18px; margin-left:-1px; border-radius:1px; background:#fff; box-shadow:0 0 8px #fff; transition:left .25s cubic-bezier(.2,.7,.2,1); }
#tourGo { flex:none; padding:6px 13px; font-size:12px; border-radius:999px; white-space:nowrap; }
body.touring .dock { opacity:0; pointer-events:none; transform:translate(-50%, 24px); }
.d-row input[type="range"] { -webkit-appearance:none; appearance:none; flex:1; min-width:140px; height:4px; border-radius:2px; margin:0 6px;
  background:var(--line-strong); }
#tSlider { background:linear-gradient(90deg, var(--st-solid), var(--st-liquid) 35%, var(--st-gas)); opacity:.9; }
.d-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance:none; width:20px; height:20px; border-radius:50%; background:#fff; border:0; box-shadow:0 0 14px rgba(255,255,255,.7); cursor:grab; }
.d-row input[type="range"]::-moz-range-thumb { width:20px; height:20px; border-radius:50%; background:#fff; border:0; }

/* ── The atom's panel ──────────────────────────────────────────────────────────────── */
.p-nav { display:flex; justify-content:space-between; gap:8px; margin-top:14px; }
.p-nav .btn { padding:6px 12px; font-size:12px; border-radius:999px; }
.p-nav .btn[disabled] { opacity:.3; pointer-events:none; }
/* The orbital diagram: a box for each orbital, an arrow for each electron. */
.orbs { display:flex; flex-wrap:wrap; gap:10px 12px; margin:2px 0 8px; }
.orb { --c:var(--cyan); display:flex; flex-direction:column; align-items:flex-start; gap:4px; text-align:left; }
.orb .boxes { display:flex; gap:2px; }
.orb .boxes u { width:19px; height:24px; border:1px solid color-mix(in srgb, var(--c) 50%, transparent); border-radius:5px; text-decoration:none; font-size:11px; line-height:22px;
  text-align:center; color:var(--c); letter-spacing:-1.5px; transition:background .2s, border-color .2s; }
.orb > span { font-size:11.5px; font-weight:500; color:var(--ink-soft); }
button.orb:hover .boxes u, .orb.on .boxes u { background:color-mix(in srgb, var(--c) 20%, transparent); border-color:var(--c); }
.orb.on > span { color:#fff; }
.cfg { font-size:15px; color:var(--ink); margin:0 0 10px; letter-spacing:.01em; }
.p-src { font-size:11px; color:var(--ink-faint); margin:18px 0 0; }
.p-src a { color:inherit; }

@media (prefers-reduced-motion: reduce) { .el, .el[data-st="liquid"]::after, .ptable.in .el.flip { animation:none; } }

/* ── States Of Matter ──────────────────────────────────────────────────────────────── */
body.states-page .tools { width:max-content; max-width:calc(100% - 24px); white-space:nowrap; }
body.states-page .tools .slice input { width:200px; }
body.states-page .tools .slice input:disabled { opacity:.55; cursor:default; }
body.states-page .tools .slice input:disabled::-webkit-slider-thumb { cursor:default; }
body.states-page .axes button:disabled { opacity:.38; cursor:default; }
body.states-page .axes button:disabled:hover { color:var(--ink-faint); }
/* The scale and the color key sit above the tools bar, not under it. */
body.states-page .scale { bottom:84px; }
.scale .snote { width:112px; margin-top:9px; }
.snote .rl { display:flex; justify-content:space-between; margin-bottom:3px; }
.snote .ramp { display:block; height:5px; border-radius:3px; margin-bottom:5px; background:linear-gradient(90deg,#22306b,#2a62b8,#2fb3d6,#b9fff2,#ffd166,#ff6b5c); }
.s-ctl { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:10px 0 2px; padding:8px 4px; border-radius:12px; border:1px solid var(--line); background:rgba(160,220,235,.04); }
.s-ctl .slice { padding:0 6px; gap:8px; }
.s-ctl .slice input { width:104px; }
.s-ctl .slice > span { display:inline; }   /* lab.css hides a slice's label under 1100px; here it names the control */
.s-ctl .axes button { font-size:15px; padding:2px 11px; }
body.states-page[data-depth="1"] .deep { display:none; }
/* The readouts keep their place while their numbers change: tabular figures, one line, a fixed height. */
.s-temp { display:inline-block; font-size:13px; font-weight:600; color:var(--ink); font-variant-numeric:tabular-nums; width:15ch; text-align:right; }
.s-read .fact { min-height:64px; }
.s-read .fact span { font-variant-numeric:tabular-nums; font-size:14px; white-space:nowrap; min-height:1.4em; }
.s-state { display:inline-flex; align-items:center; gap:9px; }
.s-state i { width:10px; height:10px; border-radius:50%; background:var(--c, var(--cyan)); box-shadow:0 0 12px var(--c, var(--cyan)); }
.s-plot { display:block; width:100%; height:190px; margin:4px 0 2px; border-radius:12px; border:1px solid var(--line); background:rgba(1,5,10,.45); }
.s-plot.sm { height:150px; }
.s-cap { font-size:11.5px; color:var(--ink-faint); margin:6px 0 0; line-height:1.5; }
.s-cap b { color:var(--ink-soft); font-weight:600; font-variant-numeric:tabular-nums; }
.s-note { font-size:12.5px; color:var(--ink-soft); margin:0; }
.s-sub { margin-bottom:8px; }
/* Experiments: the choices of a prediction, the color key under a graph, the split of the energy. */
.card.pick { display:flex; gap:11px; align-items:flex-start; padding:12px 14px; margin-bottom:8px; }
.card.pick span { color:var(--ink); font-size:13.5px; }
.card.pick::before { content:""; flex:none; width:15px; height:15px; margin-top:2px; border-radius:50%; border:1.5px solid var(--ink-faint); transition:border-color .2s, background .2s; }
.card.pick.on::before { border-color:var(--cyan); background:radial-gradient(circle, var(--cyan) 0 38%, transparent 44%); }
.btn:disabled { opacity:.4; cursor:default; filter:none; transform:none; }
.btn.sm { margin:0 0 4px; }
.term.miss { background:var(--warn); color:#2b1700; }
.s-key { display:flex; gap:16px; margin:7px 0 0; font-size:11.5px; color:var(--ink-soft); }
.s-key i { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.s-split { display:flex; height:10px; border-radius:6px; overflow:hidden; background:rgba(160,220,235,.08); margin:6px 0 8px; }
.s-split i { display:block; height:100%; width:0; transition:width .25s; }
.s-split .a { background:var(--cyan); }
.s-split .b { background:var(--warn); }
.s-legend { display:flex; justify-content:space-between; gap:10px; font-size:12px; color:var(--ink-soft); white-space:nowrap; }
.s-legend b { color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums; }
.s-legend .sw { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.s-legend .sw.a { background:var(--cyan); }
.s-legend .sw.b { background:var(--warn); }
body.states-page .p-tag { min-height:3.1em; }
/* Beside the panel the tools bar has less room: shorten the slider before anything overlaps. */
@media (max-width: 1320px) { body.states-page .tools .slice input { width:120px; } .s-temp { width:13ch; } }
@media (max-width: 1100px) {
  body.states-page.panel-open .tools { max-width:calc(100% - var(--panel-w) - 20px); padding:5px 6px; gap:2px; }
  body.states-page .tools .slice { padding:0 6px 0 4px; gap:6px; }
  body.states-page .tools .slice input { width:84px; }
  .s-temp { width:12ch; font-size:12px; }
  body.states-page #tReset span { display:none; }
  body.states-page #tReset { padding:6px 8px; }
}
