/* Research pages: /research/, the elements project and its element, molecule and compound pages.
   Loaded by default.html on pages with `research: true` (set for the collections in _config.yml). */

.rs-page {
  --rs-line: #eee;
  --rs-mute: #999;
  --rs-ink: #333;
  --rs-match: rgba(45, 127, 67, .10);
  --rs-accent: #2d7f43;
  --rs-bg: #fff;
  /* Periodic table: text, and a background per category */
  --pt-ink: #333;
  --pt-mute: #777;
  --pt-alkali-metal: #fbe1d3;
  --pt-alkaline-earth-metal: #fcefc7;
  --pt-transition-metal: #e1eaf6;
  --pt-post-transition-metal: #dfeee7;
  --pt-metalloid: #ece3f4;
  --pt-reactive-nonmetal: #dcefdf;
  --pt-halogen: #f6deea;
  --pt-noble-gas: #dbeff3;
  --pt-lanthanide: #f2e8d5;
  --pt-actinide: #f0dcd7;
  padding-bottom: 20px;
}
html[data-theme="dark"] .rs-page {
  --rs-line: #2e3236;
  --rs-mute: #7d7d7d;
  --rs-ink: #e0e0e0;
  --rs-match: rgba(92, 196, 116, .14);
  --rs-accent: #5cc474;
  --rs-bg: #1e2124;
  --pt-ink: #e8e8e8;
  --pt-mute: #9a9a9a;
  --pt-alkali-metal: #4a3024;
  --pt-alkaline-earth-metal: #463d1f;
  --pt-transition-metal: #26344a;
  --pt-post-transition-metal: #213a30;
  --pt-metalloid: #372c45;
  --pt-reactive-nonmetal: #1f3d27;
  --pt-halogen: #452538;
  --pt-noble-gas: #1f3d42;
  --pt-lanthanide: #40361f;
  --pt-actinide: #4a2620;
}

.rs-crumbs {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--rs-mute);
}
.rs-lead {
  font-size: 17px;
}
.rs-section h2 {
  margin-top: 28px;
  font-size: 20px;
}
.rs-empty {
  color: var(--rs-mute);
  font-style: italic;
}
.rs-source {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--rs-mute);
}
.rs-label {
  color: var(--rs-mute);
}
.rs-formula sub,
.rs-formula sup {
  font-size: 70%;
}

/* Element page header: the symbol in a tile beside the name */
.rs-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.rs-head__text {
  min-width: 0;
}
.rs-head .post-subtitle {
  margin: 0;
}
/* The second line of the header: category, period, group. Muter than the subtitle so it reads as context. */
.rs-place {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--rs-mute);
  line-height: 1.35;
}
.rs-badge {
  flex: none;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rs-accent);
  border-radius: 8px;
  font-size: 28px;
  font-weight: 700;
  color: var(--rs-accent);
}
/* Refining paragraph — the shared per-element process, above the isotope table */
.rs-refining {
  font-size: 16px;
  line-height: 1.55;
}
.rs-refining p {
  margin: 0;
}

/* Tables */
.rs-scroll {
  overflow-x: auto;
}
.rs-table {
  width: 100%;
  margin: 6px 0;
  border-collapse: collapse;
  font-size: 15px;
}
.rs-table th,
.rs-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--rs-line);
  text-align: left;
  vertical-align: top;
}
.rs-table thead th {
  font-size: 13px;
  font-weight: 400;
  color: var(--rs-mute);
  white-space: nowrap;
}
.rs-table tbody th {
  font-weight: 400;
  color: var(--rs-ink);
  white-space: nowrap;
}
.rs-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rs-list tbody tr {
  transition: background-color .15s;
}
.rs-list tbody tr.is-match {
  background: var(--rs-match);
}
.rs-list tbody tr.is-match th {
  box-shadow: inset 3px 0 0 var(--rs-accent);
}

/* Molecules and compounds an element appears in */
.rs-in {
  padding-left: 18px;
}

/* Isomers */
.rs-isomer h3 {
  margin: 18px 0 4px;
  font-size: 17px;
  color: var(--rs-ink);
}
.rs-isomer h3 .rs-formula {
  margin-left: 6px;
  font-size: 15px;
  color: var(--rs-mute);
}

/* /research/ */
.rs-projects {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.rs-projects li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rs-line);
}
.rs-projects h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.rs-projects p {
  margin: 0 0 4px;
}

/* Periodic table: 18 columns; lanthanides and actinides in rows 9 and 10 after a spacer row */
.pt-scroll {
  overflow-x: auto;
  margin: 16px 0 8px;
  padding-bottom: 4px;
}
.pt {
  position: relative;
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto) 10px auto auto;
  gap: 3px;
  min-width: 560px;
}
.pt .pt-cell,
.pt .pt-cell:link,
.pt .pt-cell:visited {
  position: relative;
  aspect-ratio: 1 / 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--pt-ink);
  line-height: 1;
  text-decoration: none;
  transition: transform .1s, box-shadow .1s, opacity .15s;
}
.pt .pt-cell:hover,
.pt .pt-cell:focus-visible {
  color: var(--pt-ink);
  text-decoration: none;
  transform: scale(1.12);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.pt-cell:focus-visible,
.pt-cell.is-selected {
  outline: 2px solid var(--rs-accent);
  outline-offset: 1px;
  z-index: 2;
}
.pt-num {
  font-size: 9px;
  color: var(--pt-mute);
}
.pt-sym {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
}
.pt-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.pt-alkali-metal { background: var(--pt-alkali-metal); }
.pt-alkaline-earth-metal { background: var(--pt-alkaline-earth-metal); }
.pt-transition-metal { background: var(--pt-transition-metal); }
.pt-post-transition-metal { background: var(--pt-post-transition-metal); }
.pt-metalloid { background: var(--pt-metalloid); }
.pt-reactive-nonmetal { background: var(--pt-reactive-nonmetal); }
.pt-halogen { background: var(--pt-halogen); }
.pt-noble-gas { background: var(--pt-noble-gas); }
.pt-lanthanide { background: var(--pt-lanthanide); }
.pt-actinide { background: var(--pt-actinide); }

/* 57–71 and 89–103: open their series in the quick look (or jump to its row without the script) */
.pt .pt-series,
.pt .pt-series:link,
.pt .pt-series:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--pt-mute);
  font-size: 9px;
  color: var(--pt-mute);
  text-decoration: none;
}
.pt .pt-series:hover,
.pt .pt-series:focus-visible,
.pt .pt-series.is-selected {
  color: var(--rs-accent);
  box-shadow: inset 0 0 0 1px var(--rs-accent);
  text-decoration: none;
}
.pt .pt-series.is-selected {
  outline: 2px solid var(--rs-accent);
  outline-offset: 1px;
}

/* A series is open: its row is outlined, everything else steps back */
.pt.is-series .pt-cell:not(.in-series) {
  opacity: .35;
}
.pt .pt-cell.in-series {
  outline: 1px solid var(--rs-accent);
  outline-offset: 1px;
}

/* Quick look: fills the empty space above the transition metals; its content never resizes the grid */
.pt-look {
  grid-column: 3 / 13;
  grid-row: 1 / 4;
  position: relative;
  margin: 0 4px 4px;
}
.pt-look[hidden] {
  display: none;
}
.pt-look__in {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 10px;
  padding: 5px 8px;
  overflow: auto;
  border: 1px solid var(--rs-line);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
}
/* Centered by auto margins, so a long quick look scrolls from its top instead of being cut off above */
.pt-look__in > * {
  margin-top: auto;
  margin-bottom: auto;
}
.pt-look__in p {
  margin: 0;
}
.pt-look__hint {
  width: 100%;
  text-align: center;
  color: var(--pt-mute);
}
.pt-look__sym {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rs-accent);
  border-radius: 6px;
  font-size: 19px;
  font-weight: 700;
  color: var(--rs-accent);
}
.pt-look__text {
  min-width: 0;
  flex: 1;
}
.pt-look__title strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--pt-ink);
}
.pt-look__open {
  float: right;
  margin-left: 8px;
}
.pt-look sup {
  font-size: 70%;
}
.pt-look__close {
  display: none;
}
.pt-look__series {
  flex: 1;
  min-width: 0;
}
.pt-look__tiles {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
  margin-top: 4px;
}
.pt-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0 3px;
  border: 0;
  border-radius: 3px;
  font: inherit;
  line-height: 1;
  color: var(--pt-ink);
  cursor: pointer;
}
.pt-tile small {
  font-size: 8px;
  color: var(--pt-mute);
}
.pt-tile b {
  font-size: 13px;
}
.pt-tile:hover,
.pt-tile:focus-visible {
  outline: 2px solid var(--rs-accent);
  outline-offset: 1px;
}
.pt-look__back {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--rs-accent);
  cursor: pointer;
}
.pt-look__back:hover {
  text-decoration: underline;
}

/* Table wider than the screen (set by the script): the quick look is a card pinned to the bottom of the
   screen, shown only while an element is selected */
.is-narrow .pt-look {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  max-width: 480px;
  margin: 0 auto;
}
.is-narrow .pt-look:not(.is-open) {
  display: none;
}
.is-narrow .pt-look__in {
  position: static;
  padding: 10px 36px 10px 12px;
  background: var(--rs-bg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  font-size: 14px;
  line-height: 1.4;
}
.is-narrow .pt-tile {
  padding: 6px 0 7px;
}
.is-narrow .pt-look__close {
  display: block;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--pt-mute);
  cursor: pointer;
}

.pt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--rs-mute);
}
.pt-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pt-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

/* Electron shells on element pages (_includes/research/electron-shells.html) */
.rs-page {
  --ec-outer: #2d7f43;
  --ec-inner: #9ccfa9;
  --ec-core: #b9b9b9;
  --ec-ring: #e2e2e2;
}
html[data-theme="dark"] .rs-page {
  --ec-outer: #5cc474;
  --ec-inner: #2f6a3e;
  --ec-core: #5a5f64;
  --ec-ring: #33383d;
}
.ec-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}
.ec {
  flex: none;
  width: 220px;
  height: 220px;
}
.ec-ring {
  fill: none;
  stroke: var(--ec-ring);
  stroke-width: 1;
}
.ec-ring--outer {
  stroke: var(--ec-outer);
  stroke-opacity: .45;
}
.ec .ec-core { fill: var(--ec-core); }
.ec .ec-inner { fill: var(--ec-inner); }
.ec .ec-outer { fill: var(--ec-outer); }
.ec-nucleus {
  fill: none;
  stroke: var(--rs-accent);
  stroke-width: 1.5;
}
.ec-symbol {
  fill: var(--rs-ink, currentColor);
  font-size: 15px;
  font-weight: 700;
}
.ec-text {
  flex: 1 1 200px;
  min-width: 0;
}
.ec-text p {
  margin: 0 0 6px;
}
.ec-text sup {
  font-size: 70%;
}
.ec-config {
  font-size: 18px;
  color: var(--pt-ink);
}
.ec-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--rs-mute);
}
.ec-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ec-key {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.ec-legend .ec-core { background: var(--ec-core); }
.ec-legend .ec-inner { background: var(--ec-inner); }
.ec-legend .ec-outer { background: var(--ec-outer); }

/* Molecule structures on molecule pages (_includes/research/molecule-structure.html) */
.rs-page {
  --ms-bond: #9a9a9a;
  --ms-c: #2e2e2e;
  --ms-c-ink: #fff;
  --ms-h: #fff;
  --ms-h-line: #b9b9b9;
  --ms-h-ink: #444;
  --ms-o: #d64541;
  --ms-o-ink: #fff;
  --ms-n: #3b6fd8;
  --ms-n-ink: #fff;
  --ms-s: #e0b100;
  --ms-s-ink: #333;
  --ms-other: #2d7f43;
  --ms-other-ink: #fff;
  --ms-fe: #3a4fb0;
  --ms-cu: #1b8a8c;
  --ms-pb: #56627a;
  --ms-ca: #7b5cc4;
}
html[data-theme="dark"] .rs-page {
  --ms-bond: #6a6f74;
  --ms-c: #b4b8bc;
  --ms-c-ink: #16181a;
  --ms-h: #e8e8e8;
  --ms-h-line: #e8e8e8;
  --ms-h-ink: #16181a;
  --ms-o: #ff7b72;
  --ms-o-ink: #16181a;
  --ms-n: #79a6ff;
  --ms-n-ink: #16181a;
  --ms-s: #e6c24a;
  --ms-s-ink: #16181a;
  --ms-other: #5cc474;
  --ms-other-ink: #16181a;
  --ms-fe: #8c9bff;
  --ms-cu: #4cc6c8;
  --ms-pb: #9fb0cf;
  --ms-ca: #b39cf0;
}
.ms-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}
.ms-wrap p {
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
}
.ms {
  flex: none;
  max-width: 100%;
  height: auto;
}
.ms-bond {
  stroke: var(--ms-bond);
  stroke-width: 2.5;
  stroke-linecap: round;
}
.ms-atom circle {
  fill: var(--ms-other);
}
.ms-atom text {
  fill: var(--ms-other-ink);
  font-size: 13px;
  font-weight: 700;
}
.ms-atom--C circle { fill: var(--ms-c); }
.ms-atom--C text { fill: var(--ms-c-ink); }
.ms-atom--H circle { fill: var(--ms-h); stroke: var(--ms-h-line); stroke-width: 1.5; }
.ms-atom--H text { fill: var(--ms-h-ink); font-size: 11px; }
.ms-atom--O circle { fill: var(--ms-o); }
.ms-atom--O text { fill: var(--ms-o-ink); }
.ms-atom--N circle { fill: var(--ms-n); }
.ms-atom--N text { fill: var(--ms-n-ink); }
.ms-atom--S circle { fill: var(--ms-s); }
.ms-atom--S text { fill: var(--ms-s-ink); }
/* Unit cells use the same circles; metals get their own colors so chalcopyrite's Cu and Fe differ */
circle.ms-atom { fill: var(--ms-other); stroke: var(--rs-bg, #fff); stroke-width: 1; }
.ms-atom--Fe circle, circle.ms-atom--Fe { fill: var(--ms-fe); }
.ms-atom--Cu circle, circle.ms-atom--Cu { fill: var(--ms-cu); }
.ms-atom--Pb circle, circle.ms-atom--Pb { fill: var(--ms-pb); }
.ms-atom--Ca circle, circle.ms-atom--Ca { fill: var(--ms-ca); }
circle.ms-atom--C { fill: var(--ms-c); }
circle.ms-atom--O { fill: var(--ms-o); }
circle.ms-atom--S { fill: var(--ms-s); }
circle.ms-atom--H { fill: var(--ms-h); }
.cl {
  flex: none;
  max-width: 100%;
  height: auto;
}
.cl-edge {
  stroke: var(--ms-bond);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.cl-bond {
  stroke: var(--ms-bond);
  stroke-width: 1.5;
}
.ms-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.ms-key li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ms-key svg {
  display: block;
  width: 14px;
  height: 14px;
}


/* Isotope table on narrow screens: each row becomes a card so the "obtained" cell can breathe.
   Kicks in below 900px, which covers both mobile (sidebar folded above) and tablet at 768px+
   where col-sm-8 leaves the isotope table only ~500px to work with. */
@media (max-width: 899.98px) {
  .rs-isotopes {
    display: block;
  }
  .rs-isotopes thead {
    /* accessible-hidden: still read by screen readers via the data-label attributes on cells */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .rs-isotopes tbody,
  .rs-isotopes tr {
    display: block;
  }
  .rs-isotopes tr {
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--rs-line);
  }
  .rs-isotopes tbody tr:last-child {
    border-bottom: 0;
  }
  .rs-isotopes th,
  .rs-isotopes td {
    display: block;
    padding: 0;
    border: 0;
  }
  .rs-isotopes tbody th {
    font-size: 20px;
    margin-bottom: 4px;
    color: var(--rs-ink);
  }
  .rs-isotopes tbody th sup {
    font-size: 65%;
  }
  .rs-isotopes tbody th[data-label]::before {
    content: none;
  }
  /* Numeric cells side by side on one line: mass then abundance, each with its own label */
  .rs-isotopes .rs-num {
    display: inline-block;
    margin-right: 18px;
    font-size: 14px;
  }
  .rs-isotopes .rs-num[data-label]::before {
    content: attr(data-label) " ";
    color: var(--rs-mute);
    font-size: 12px;
    letter-spacing: .02em;
    margin-right: 3px;
  }
  /* "How this isotope is separated" cell on its own line under the numbers */
  .rs-isotopes td:not(.rs-num) {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.5;
  }
  .rs-isotopes td:not(.rs-num):empty {
    display: none;
  }
  .rs-isotopes td[data-label]:not(.rs-num)::before {
    content: attr(data-label);
    display: block;
    color: var(--rs-mute);
    font-size: 12px;
    letter-spacing: .02em;
    margin-bottom: 2px;
  }
}
