:root { --ink: #1a1a1a; --muted: #5b5b5b; --line: #dcd8cf; --panel: #ffffff; --bg: #f6f4ef; --accent: #8a1c1c; --stripe: #f4f2ee; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; padding: 10px 20px;
       border-bottom: 1px solid var(--line); background: var(--panel); }
.top .brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14.5px; }
.top nav a { text-decoration: none; }
.top nav a[aria-current] { color: var(--ink); font-weight: 600; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; margin: 26px 0 10px; text-wrap: balance; }
h2 { font-size: 22px; margin: 40px 0 10px; }
.lead { font-size: 17.5px; max-width: 78ch; margin: 0 0 16px; }
/* isotope switch under the title */
.iso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 18px; }
.iso > span { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.iso > div { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.iso a { display: flex; flex-direction: column; min-width: 124px; padding: 6px 16px 7px; border-radius: 9px; text-decoration: none;
         color: var(--ink); line-height: 1.25; transition: background .12s; }
.iso a b { font-size: 18px; }
.iso a sup { font-size: .62em; }
.iso a small { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.iso a small span + span::before { content: " · "; }
.iso a:hover { background: var(--stripe); }
.iso a[aria-current] { background: var(--ink); color: #fff; cursor: default; }
.iso a[aria-current] small { color: rgba(255, 255, 255, .72); }
@media (max-width: 640px) { .iso > div { display: flex; flex-wrap: nowrap; width: 100%; }
                            .iso a { flex: 1; min-width: 0; padding: 6px 9px 7px; } .iso a small { font-size: 11.5px; }
                            .iso a small span { display: block; } .iso a small span + span::before { content: none; } }
.hint { color: var(--muted); font-size: 14.5px; margin: 0 0 8px; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14.5px; margin: 10px 0 0; }

#stage { position: relative; height: min(82vh, 900px); min-height: 420px; overflow: hidden; background: #fff; cursor: grab;
         touch-action: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#stage.dragging { cursor: grabbing; }
#stage svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
#stage .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
#stage .loading img { max-width: 100%; max-height: 100%; opacity: .5; }
/* emphasis: every transition fades unless it carries .hl (selected) or .sf (glanced at next to the selection) */
svg [id^="tr-"], svg [id^="trl-"] { transition: opacity .12s; }
svg.dim [id^="tr-"], svg.dim [id^="trl-"] { opacity: .07; }
svg.dim [id^="tr-"].sf, svg.dim [id^="trl-"].sf { opacity: .4; transition-delay: .05s; }
svg.dim [id^="tr-"].hl, svg.dim [id^="trl-"].hl { opacity: 1; }
svg [id^="hit-"], svg [id^="trl-"], svg [id^="lv"] { cursor: pointer; }
svg [id^="hit-"] path { pointer-events: stroke; }
#zoom { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
#zoom button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
               color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
#zoom button:hover { border-color: var(--muted); }
#zoom button.wide { width: auto; padding: 0 12px; font-size: 13.5px; }
#info { position: absolute; right: 12px; top: 12px; width: min(350px, calc(100% - 24px)); max-height: calc(100% - 24px);
        overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
        background: rgba(255, 255, 255, .96); box-shadow: 0 4px 18px rgba(0, 0, 0, .08); font-size: 14px; line-height: 1.4;
        cursor: auto; overscroll-behavior: contain; }
#info.pinned { border-color: var(--muted); box-shadow: 0 6px 22px rgba(0, 0, 0, .16); }
#info .bar { position: sticky; top: -12px; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px;
             min-height: 30px; margin: -12px -14px 10px; padding: 2px 6px 2px 14px; border-bottom: 1px solid var(--line);
             background: var(--panel); font-size: 12.5px; color: var(--muted); }
#info button { font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0; cursor: pointer; }
#info .bar button { padding: 2px 8px; margin-left: -8px; border-radius: 6px; }
#info .bar button:hover { background: var(--stripe); color: var(--ink); }
#info .bar .close { margin: 0; font-size: 20px; line-height: 1; }
#info h3 { font-size: 17px; margin: 0 0 6px; }
#info h3 button { text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: var(--muted);
                  text-underline-offset: 4px; }
#info h3 button:hover { color: var(--accent); }
#info .tag { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
#info table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
#info td, #info th { padding: 3px 0; text-align: left; vertical-align: baseline; }
#info td:last-child, #info th:last-child { text-align: right; }
#info td:first-child { color: var(--muted); padding-right: 10px; }
#info table.lines td:first-child { color: var(--ink); }
#info table.lines th { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
#info table.lines tr.row { cursor: pointer; }
#info table.lines tr.row:hover td { background: var(--stripe); }
/* a level's lines: a click on a column head sorts by that column */
#info table.sortable { margin-top: 8px; }
#info table.sortable th:nth-child(n+2), #info table.sortable td:nth-child(n+2) { text-align: right; padding-left: 10px; white-space: nowrap; }
#info table.sortable th button { font-weight: 600; white-space: nowrap; text-decoration: underline dotted var(--line); text-underline-offset: 3px; }
#info table.sortable th button:hover, #info table.sortable th[aria-sort] button { color: var(--ink); }
#info table.sortable .swatch { width: 14px; margin-right: 6px; }
#info .note { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
/* frame around the level the pointer would pick (.hov) and around the pinned level (.pin); the pointer only has to come near */
#stage svg.pick { cursor: pointer; }
.lvbox { pointer-events: none; vector-effect: non-scaling-stroke; stroke: var(--accent); }
.lvbox.hov { fill: rgba(138, 28, 28, .07); stroke-width: 1.5px; }
.lvbox.pin { fill: none; stroke-width: 2.5px; }
/* the enlarged label of a pinned line must not shield the lines under it from the pointer */
[id^="trl-"].grown { pointer-events: none; }
/* decay channels of the pinned line's upper level: wavy arrows drawn by viewer.js */
#decay { pointer-events: none; }
#decay path { fill: none; stroke-width: calc(2.2px * var(--g, 1)); stroke-linejoin: round; stroke-linecap: round; }
#decay path.halo { stroke: #fff; stroke-width: calc(6.5px * var(--g, 1)); opacity: .9; }
#decay text { font-size: calc(12.5px * var(--g, 1)); font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central;
              paint-order: stroke; stroke: #fff; stroke-width: calc(4.5px * var(--g, 1)); stroke-linejoin: round; }
/* the decay lines of the levels further down the cascade: a little lighter than those of the pinned line's upper level */
#decay .next path:not(.halo) { stroke-width: calc(1.7px * var(--g, 1)); }
#decay text.next { font-weight: 600; fill: #3d3d3d; }
/* emphasis by the share of the atoms an arrow carries: 1 % and more full weight, 0.1-1 % lighter, below 0.1 % faint */
#decay .w-minor path:not(.halo), #decay .w-minor polygon { opacity: .75; }
#decay .w-minor path:not(.halo) { stroke-width: calc(1.5px * var(--g, 1)); }
#decay .w-faint path:not(.halo), #decay .w-faint polygon { opacity: .4; }
#decay .w-faint path:not(.halo) { stroke-width: calc(1px * var(--g, 1)); }
#decay .w-faint path.halo { opacity: .6; stroke-width: calc(4px * var(--g, 1)); }
#decay text.w-minor { font-weight: 600; font-size: calc(11px * var(--g, 1)); fill: #333; }
#decay text.w-faint { font-weight: 500; font-size: calc(10.5px * var(--g, 1)); fill: #555; }
#info .cyc { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
#info .cyc h4 { margin: 0 0 4px; font-size: 13.5px; }
#info .cyc p { margin: 0; font-size: 13.5px; }
#info .cyc button { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
#info .cyc td:last-child { white-space: nowrap; }
#info .cyc table.lines { margin-top: 6px; }
#info .cyc table.lines td:nth-child(2) { text-align: right; padding-right: 12px; color: var(--muted); white-space: nowrap; }
#info .cyc table.steps td:nth-child(2) { text-align: left; color: var(--ink); white-space: normal; }
#info .cyc table.steps td:nth-child(2)::before { content: "→ "; color: var(--muted); }
#info .cyc .dark { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 6px; white-space: nowrap; }
#info .swatch { display: inline-block; width: 26px; height: 5px; border-radius: 3px; vertical-align: middle; margin-right: 8px; }
.tier { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 4px; margin-left: 6px;
        border: 1px solid currentColor; vertical-align: 1px; white-space: nowrap; }
.tier.exp, .tier.nist { color: #1d6b3a; }
.tier.theory { color: #7a5a00; }
.tier.model, .tier.semi, .tier.hfr { color: #8a1c1c; }

.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table.data { border-collapse: collapse; width: 100%; font-size: 14.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 6px 12px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child, table.data .l { text-align: left; }
table.data .wrapcell { white-space: normal; min-width: 22ch; }
table.data thead th { position: sticky; top: 0; background: #e6e3dc; font-weight: 600; }
table.data tbody tr:nth-child(even) { background: var(--stripe); }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 0; white-space: pre-line; }
.sources { font-size: 14.5px; padding-left: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin: 22px 0; padding: 0; list-style: none; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
        text-decoration: none; color: var(--ink); height: 100%; }
.card:hover { border-color: var(--muted); }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; border-bottom: 1px solid var(--line); background: #fff; }
.card div { padding: 12px 14px 14px; }
.card strong { font-size: 18px; display: block; }
.card span { color: var(--muted); font-size: 14px; }
footer { margin: 50px 0 30px; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) { #info { top: auto; bottom: 12px; max-height: 45%; } }
#filters { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
           max-width: calc(100% - 24px); font-size: 13.5px; color: var(--muted); }
#filters:empty { display: none; }
#filters button { border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink);
                  padding: 5px 11px; font-size: 13.5px; cursor: pointer; }
#filters button small { color: var(--muted); }
#filters button[aria-pressed="false"] { background: transparent; color: var(--muted); text-decoration: line-through; }

/* ---------- periodic table on the landing page */
.ptools { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; margin: 18px 0 14px; font-size: 14.5px; }
.ptools input { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin-left: 6px; width: 190px; background: var(--panel); color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 0; color: var(--muted); font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend span { width: 13px; height: 13px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend .cur span { background: none; box-shadow: inset 0 0 0 2px var(--ink); }
.pscroll { overflow-x: auto; padding: 4px 20px 18px; }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(58px, 1fr)); grid-template-rows: repeat(7, auto) 14px auto auto;
          gap: 5px; max-width: 1380px; min-width: 1120px; margin: 0 auto; }
.el { --c: #b9b4aa; position: relative; display: flex; flex-direction: column; aspect-ratio: 1 / 1.22; padding: 5px 6px 5px;
      border-radius: 8px; text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--c) 26%, #fff);
      border: 1px solid color-mix(in srgb, var(--c) 55%, #fff); transition: transform .12s, box-shadow .12s, opacity .12s; overflow: hidden; }
.el .z { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.el .sym { font-size: clamp(18px, 1.75vw, 25px); font-weight: 700; line-height: 1.15; margin-top: auto; }
.el .nm { font-size: 10.5px; line-height: 1.35; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el .ct { font-size: 10px; line-height: 1.3; color: var(--muted); flex: none; }
a.el:hover, a.el:focus-visible { transform: translateY(-3px) scale(1.07); z-index: 2; box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
                                 background: color-mix(in srgb, var(--c) 45%, #fff); outline: none; }
.el.curated { box-shadow: inset 0 0 0 2px var(--ink); }
.el.curated::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.el.nolevels { border-style: dashed; }
.el.none { opacity: .38; background: transparent; border-style: dashed; }
.el.gap { background: transparent; border: none; color: var(--muted); font-size: 12px; align-items: center; justify-content: center; }
.el.dimmed { opacity: .18; }
.alkali { --c: #e0672e; } .alkaline-earth { --c: #d9a300; } .transition { --c: #4f86c6; } .post-transition { --c: #4aa88a; }
.metalloid { --c: #8a9a3c; } .nonmetal { --c: #b05cb8; } .noble-gas { --c: #7a6fd0; } .lanthanide { --c: #c4577a; } .actinide { --c: #a8744a; }
.superheavy { --c: #b9b4aa; }
@media (prefers-reduced-motion: reduce) { .el { transition: none; } a.el:hover { transform: none; } }
