.atom-stage {
  --atom-border: #353745;
  --atom-panel: #171922;
  --atom-ink: #f5f7fa;
  --atom-muted: #c2cada;
  --atom-accent: #ff9b51;
  min-width: 0;
  color: var(--atom-ink);
  color-scheme: dark;
}

.element-main.atom-element-main {
  width: 100%;
  padding-top: 0;
}

.atom-element-main > .breadcrumb,
.atom-element-main > .element-content,
.atom-fact-strip,
.atom-stage-ui {
  width: min(calc(100% - 48px), var(--reading-width));
  margin-inline: auto;
}

.atom-element-main > .breadcrumb {
  min-height: 45px;
  margin-block: 0;
  padding-block: 6px;
  align-items: center;
}

.atom-element-main > .breadcrumb a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.atom-stage [hidden] {
  display: none !important;
}

.atom-stage-frame {
  position: relative;
  isolation: isolate;
  height: 75vh;
  height: 75svh;
  min-height: 31rem;
  overflow: hidden;
  background:
    radial-gradient(1px 1px at 14% 17%, #e1e7ff90, transparent),
    radial-gradient(1px 1px at 24% 31%, #e1e7ff50, transparent),
    radial-gradient(1px 1px at 37% 13%, #e1e7ff65, transparent),
    radial-gradient(1px 1px at 52% 16%, #e1e7ff90, transparent),
    radial-gradient(1px 1px at 66% 19%, #e1e7ff75, transparent),
    radial-gradient(1px 1px at 72% 33%, #e1e7ff90, transparent),
    radial-gradient(1px 1px at 81% 13%, #e1e7ff65, transparent),
    radial-gradient(1px 1px at 94% 43%, #e1e7ff80, transparent),
    radial-gradient(1px 1px at 97% 25%, #e1e7ff60, transparent),
    radial-gradient(1px 1px at 83% 73%, #e1e7ff80, transparent),
    radial-gradient(ellipse at 72% 46%, color-mix(in srgb, var(--family) 22%, #090b12) 0%, #0a0c14 52%, #080a11 100%);
}

.atom-viewport {
  position: absolute;
  inset: 0 2% 11% 31%;
  overflow: hidden;
  touch-action: pan-y;
}

.atom-viewport > .atom-poster,
.atom-viewport > .atom-still,
.atom-viewport > canvas[data-atom-canvas] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.atom-viewport > canvas[data-atom-canvas] {
  pointer-events: none;
}

.atom-viewport[data-interacting="true"],
.atom-viewport[data-interacting="true"] > canvas[data-atom-canvas] {
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.atom-viewport[data-interacting="true"] > canvas[data-atom-canvas]:active {
  cursor: grabbing;
}

.atom-hero-copy {
  position: absolute;
  inset: auto auto 7.2rem 0;
  z-index: 1;
  width: min(60%, 49rem);
  padding: 1.4rem clamp(1.75rem, 5vw, 5rem);
  isolation: isolate;
}

.atom-hero-copy::before {
  position: absolute;
  inset: -20% -14% -32% 0;
  z-index: -1;
  background: linear-gradient(90deg, #080a11 0%, #080a11e8 88%, #080a1100 100%);
  mask-image: linear-gradient(transparent, #000 14%, #000 81%, transparent);
  pointer-events: none;
  content: "";
}

.atom-family {
  display: block;
  margin-bottom: .35rem;
  color: var(--family);
  font-size: .8rem;
  font-weight: 780;
  letter-spacing: .045em;
}

.atom-hero-copy h1 {
  margin: 0;
  color: var(--atom-ink);
  font-size: clamp(2.6rem, 5.6vw, 6.5rem);
  line-height: 1.02;
  letter-spacing: -.052em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.atom-hero-copy h1 em { color: var(--family); font-size: .73em; font-style: normal; }
.atom-hero-copy .element-lede { margin: .55rem 0 0; color: var(--atom-ink); font-size: clamp(1rem, 1.5vw, 1.22rem); }
.atom-hero-copy .muted { margin-top: .35rem; color: var(--atom-muted); }

.atom-hero-actions {
  position: absolute;
  z-index: 2;
  inset: 1rem 1rem auto auto;
  display: grid;
  justify-items: end;
  gap: .45rem;
}

.atom-model-caption {
  position: absolute;
  z-index: 2;
  inset: 1rem auto auto 1rem;
  display: grid;
  justify-items: start;
  gap: .12rem;
  color: var(--atom-muted);
  font-size: .8125rem;
}

.atom-model-caption span {
  padding: .22rem .55rem;
  border-radius: .4rem;
  background: #10131de8;
}

.atom-model-caption button[data-atom-open-cloud] {
  padding-inline: .55rem;
  background: #10131de8;
  border-color: #535970;
  color: var(--atom-ink);
  font-size: .8125rem;
}

.atom-gesture, .atom-render-note {
  color: var(--atom-ink);
  background: #10131dde;
  border-radius: 100vw;
  padding: .2rem .65rem;
  font-size: .81rem;
}

.atom-stage button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #4d5264;
  border-radius: 10px;
  background: #232633;
  color: var(--atom-ink);
  font: inherit;
  font-size: .88rem;
  line-height: 1.25;
  font-weight: 680;
  cursor: pointer;
}

.atom-stage button:hover {
  border-color: #ff9b51;
  color: #ffcb9f;
}

.atom-stage :is(button, a):focus-visible,
.atom-stage input:focus-visible {
  outline: 2px solid #ffb347;
  outline-offset: 3px;
}

.atom-stage button:disabled {
  cursor: default;
  opacity: .56;
}

.atom-stage button.atom-activate {
  background: #181822f2;
  border-color: #99663f;
  border-radius: 100vw;
  color: #ffe1c9;
}

.atom-zoom {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  display: flex;
  gap: 7px;
}

.atom-zoom button {
  padding-inline: 0;
  border-radius: 50%;
  background: #191d2aeb;
  font-size: 1.15rem;
}

.atom-facts-jump {
  position: absolute;
  bottom: 4.2rem;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: .45rem;
  padding: 4px .5rem;
  border-radius: 100vw;
  background: #0a0c14e8;
  font-size: .82rem;
  font-weight: 720;
  white-space: nowrap;
}

.element-main.atom-element-main .atom-stage a.atom-facts-jump[href] {
  color: var(--atom-ink);
  text-decoration: none;
}

.atom-facts-jump span {
  width: .5rem;
  height: .5rem;
  margin-top: -.2rem;
  border-right: 2px solid var(--atom-accent);
  border-bottom: 2px solid var(--atom-accent);
  transform: rotate(45deg);
  animation: atom-facts-nudge 2.4s ease-in-out 3;
}

@keyframes atom-facts-nudge {
  50% { transform: translateY(.2rem) rotate(45deg); }
}

.atom-stage-tabs {
  position: absolute;
  z-index: 3;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 21rem), 38rem);
  display: grid;
  grid-template-columns: minmax(44px, .85fr) minmax(44px, 1.65fr) minmax(44px, 1.35fr) repeat(2, minmax(44px, .72fr));
  gap: .35rem;
}

.atom-stage-tabs button {
  padding: 4px;
  border: 1px solid #535970;
  border-radius: 100vw;
  background: #191d2aee;
  color: var(--atom-muted);
}

.atom-stage-tabs button[aria-selected="true"] {
  border-color: #72533e;
  background: #312720;
  color: #ffd5b2;
}

.atom-fact-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1.5rem;
  padding-block: .65rem;
  border-bottom: 1px solid var(--atom-border);
}

.atom-fact-strip .element-facts {
  flex: 1 1 31rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  gap: 0;
}

.atom-fact-strip .element-facts > div {
  padding: .4rem .75rem .4rem 0;
  border: 0;
  background: transparent;
}

.atom-fact-strip .element-facts dt { min-height: 0; }
.atom-fact-strip .element-facts dd { font-size: .97rem; overflow-wrap: anywhere; }
.atom-fact-strip .element-hero-actions { gap: .65rem; margin: 0; }
.atom-stage-ui { margin-block: 1.35rem; border-radius: .85rem; background: var(--atom-panel); }

.atom-stage-panel {
  padding: clamp(12px, 2.6vw, 22px);
  min-width: 0;
}

.atom-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  align-items: center;
}

.atom-identity b {
  color: var(--atom-ink);
}

.atom-identity span,
.atom-stage p.atom-guide,
.atom-stage p.atom-source {
  color: var(--atom-muted);
  font-size: .86rem;
  line-height: 1.45;
}

.atom-stage p.atom-guide,
.atom-stage p.atom-source {
  margin: 8px 0 0;
}

.atom-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 19px;
  margin: 7px 0 12px;
  color: var(--atom-muted);
  font-size: .88rem;
}

.atom-counts b {
  color: #f1f4fc;
}

.atom-shells,
.atom-save-controls,
.atom-ion-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.atom-ion-presets { margin-top: .65rem; }
.atom-ion-presets button[aria-pressed="true"] { border-color: var(--atom-accent); }
.atom-save-controls button span { display: block; margin-top: .2rem; color: var(--atom-muted); font-size: .77rem; }

.atom-shells button {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.atom-shells button span {
  color: #9fdfff;
  font-size: .8rem;
}

.atom-shells button[aria-pressed="true"] {
  border-color: #ffb347;
  background: #312720;
}

.atom-stage .atom-range,
.atom-isotope-controls label {
  display: block;
  min-width: 0;
  color: var(--atom-ink);
  font-size: .88rem;
  font-weight: 655;
}

.atom-stage input[type="range"] {
  display: block;
  margin: 0;
  width: 100%;
  min-height: 44px;
  accent-color: var(--atom-accent);
}

.atom-isotope-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 15px;
  align-items: end;
  margin-top: 12px;
}

.atom-ion-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.atom-ion-control output {
  min-width: 64px;
  text-align: center;
  font-weight: 740;
  white-space: nowrap;
}

.atom-isotope-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0 0;
}

.atom-isotope-facts div {
  padding: 8px 9px;
  border: 1px solid var(--atom-border);
  border-radius: 8px;
  background: #13151d;
}

.atom-isotope-facts dt {
  color: var(--atom-muted);
  font-size: .77rem;
}

.atom-isotope-facts dd {
  margin: 0;
  color: var(--atom-ink);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}

.atom-cloud-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-bottom: 14px;
}

.atom-cloud-legend span::before {
  display: inline-block;
  width: .68em;
  height: .68em;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: var(--subshell);
  content: "";
}

.atom-cloud-legend [data-kind="s"] { --subshell: #84d8ff; }
.atom-cloud-legend [data-kind="p"] { --subshell: #f78bb8; }
.atom-cloud-legend [data-kind="d"] { --subshell: #ffc181; }
.atom-cloud-legend [data-kind="f"] { --subshell: #9ded9a; }
.atom-cloud-legend [data-kind="positive"] { --subshell: #ffb785; }
.atom-cloud-legend [data-kind="negative"] { --subshell: #82b6ff; }

.atom-orbital-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .7rem;
}

.atom-orbital-field {
  display: grid;
  gap: .3rem;
  flex: 0 1 15rem;
  min-width: min(10rem, 100%);
  color: var(--atom-ink);
  font-size: .85rem;
  font-weight: 650;
}

.atom-orbital-field select {
  width: 100%;
  min-height: 44px;
  padding: .5rem;
  border: 1px solid #4d5264;
  border-radius: 10px;
  background: #232633;
  color: var(--atom-ink);
  font: inherit;
}

.atom-stage p[data-atom-orbital-note]:empty { margin: 0; }

.atom-stage .atom-source a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.element-card .element-photo { margin-top: 1rem; }
html:has(.atom-element-main) { scroll-behavior: smooth; }

@media (max-width: 660px) {
  .atom-element-main > .breadcrumb,
  .atom-element-main > .element-content,
  .atom-fact-strip,
  .atom-stage-ui { width: calc(100% - 28px); }

  .atom-stage-frame {
    height: 60vh;
    height: 60svh;
    min-height: 23.5rem;
    background: radial-gradient(ellipse at 50% 28%, color-mix(in srgb, var(--family) 24%, #090b12) 0%, #0a0c14 55%, #080a11 100%);
  }

  .atom-viewport { inset: 2.45rem 0 max(30%, 9.5rem); }

  .atom-hero-copy {
    inset: auto 0 6.9rem;
    width: 100%;
    padding: .6rem 1rem;
  }

  .atom-hero-copy::before {
    inset: -19% 0 -6%;
    background: linear-gradient(180deg, transparent, #090b12e8 15%, #090b12 100%);
    mask-image: none;
  }

  .atom-hero-copy h1 { font-size: clamp(2.15rem, 10.8vw, 4rem); text-wrap: initial; }
  .atom-hero-copy .element-lede { line-height: 1.36; }
  .atom-hero-actions { inset: .65rem .75rem auto auto; }
  .atom-model-caption { inset: .65rem auto auto .75rem; }
  .atom-gesture, .atom-render-note { max-width: calc(100vw - 1.5rem); }

  .atom-facts-jump { bottom: 3.8rem; left: .75rem; transform: none; }
  .atom-zoom { right: .75rem; bottom: 3.8rem; gap: .25rem; }

  .atom-stage-tabs { bottom: .65rem; width: calc(100% - 1.5rem); gap: .23rem; }
  .atom-stage-tabs button { font-size: .77rem; }

  .atom-fact-strip .element-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atom-fact-strip .element-hero-actions { margin-top: .35rem; }
}

@media (max-width: 570px) {

  .atom-isotope-controls {
    grid-template-columns: minmax(0,1fr);
    gap: 4px;
  }

  .atom-isotope-facts {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.atom-element-main) { scroll-behavior: auto; }
  .atom-stage *,
  .atom-stage *::before,
  .atom-stage *::after {
    animation: none !important;
    transition: none !important;
  }
}

.atom-loading-label { display: none; }
.atom-stage[data-renderer="loading"] .atom-loading-label {
  display: inline-block;
  color: #e4e9f6;
  font-size: .8rem;
}
