/* Styles for "Building Artios", on top of ../../styles.css. */

.article-content a.artios-paper-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  box-sizing: border-box;
  margin-bottom: 1rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--fg1);
  font-family: var(--font-text-variant);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.article-content a.artios-paper-link:hover {
  border-color: currentColor;
  background: #f4f7f5;
}

.article-content a.artios-paper-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Numbered parts of the post (### 1. Motif scaffolding, ...) */
.article-content h3.numbered-part {
  margin-top: 2.6rem;
  margin-bottom: 0.8rem;
  color: var(--fg);
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

.article-content h4 {
  margin-top: 1.7rem;
  color: var(--fg1);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.article-toc li.toc-sub {
  margin-left: 0.8rem;
}

.article-content ol.simple-list {
  margin: 0 0 1.25rem 1.3rem;
  color: var(--fg1);
}

.article-content ol.simple-list li,
.article-content ul.simple-list li {
  margin-bottom: 0.35rem;
}

/* Figures */
.artios-figure {
  margin: 2rem 0;
  padding: 1rem 0 0.9rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-text-variant);
}

.artios-figure.is-wide {
  width: min(960px, calc(100vw - 2rem));
  margin-left: 50%;
  transform: translateX(-50%);
}

.article-wide-image.is-wide-image {
  width: min(960px, calc(100vw - 2rem));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.article-wide-image.is-wide-image img {
  border: 0;
  border-radius: 0;
}

.article-wide-image.is-wide-image figcaption {
  max-width: var(--article-width);
  margin-right: auto;
  margin-left: auto;
}

.artios-figure figcaption,
.article-wide-image figcaption {
  margin-top: 0.8rem;
  color: var(--fg4);
  font-size: 13px;
  line-height: 1.5;
}

.artios-figure.is-wide figcaption {
  max-width: var(--article-width);
  margin-right: auto;
  margin-left: auto;
}

.artios-figure figcaption strong,
.article-wide-image figcaption strong {
  color: var(--fg2);
  font-weight: 600;
}

.figure-heading {
  margin-bottom: 0.6rem;
}

.figure-heading h3 {
  margin: 0;
  color: var(--fg2);
  font-family: var(--font-text-variant);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.figure-heading p {
  margin: 0.15rem 0 0;
  color: var(--fg4);
  font-size: 12.5px;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--font-text-variant);
}

/* Plot text and lines */
.fig-text,
.fig-label {
  fill: #3c3a36;
  font-size: 12px;
}

.fig-tick {
  fill: #7b7973;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.fig-value {
  fill: #3c3a36;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.fig-legend {
  fill: #55534e;
  font-size: 11.5px;
}

.fig-note {
  fill: #3c3a36;
  font-size: 11.5px;
}

.fig-panel {
  fill: #1f1e1c;
  font-size: 15px;
  font-weight: 700;
}

.fig-axis {
  stroke: #9a988f;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.fig-diagonal,
.fig-guide {
  stroke: #b1afa7;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.fig-connector {
  stroke: #c3c1b9;
  stroke-width: 2;
}

.fig-median {
  stroke: #1f1e1c;
  stroke-width: 1.5;
}

.fig-seq {
  fill: #8f8d86;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

.fig-seq .ala {
  fill: #1f1e1c;
  font-weight: 700;
}

/* Diagrams */
.dg-box {
  fill: #ffffff;
  stroke: #d2d0c8;
  stroke-width: 1;
}

.dg-soft {
  fill: #f7f7f4;
}

.dg-accent {
  fill: color-mix(in srgb, #118c79 7%, #ffffff);
  stroke: color-mix(in srgb, #118c79 40%, #ffffff);
}

.dg-blue {
  fill: color-mix(in srgb, #3266ad 6%, #ffffff);
  stroke: color-mix(in srgb, #3266ad 35%, #ffffff);
}

.dg-inner {
  fill: none;
  stroke: #dedcd4;
  stroke-width: 1;
}

.dg-lane {
  fill: #fbfbf9;
  stroke: #ecebe6;
}

.dg-label {
  fill: #3c3a36;
  font-size: 12.5px;
  font-weight: 500;
}

.dg-sub {
  fill: #7b7973;
  font-size: 11px;
}

.dg-arrow {
  fill: none;
  stroke: #8f8d86;
  stroke-width: 1.3;
}

.dg-dash {
  stroke: #c3c1b9;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

/* Draft markers. Remove before publishing. */
.draft-note {
  margin: 1.2rem 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid #d9a445;
  background: #fbf6ea;
  color: #6b5320;
  font-size: 13.5px;
  line-height: 1.5;
}

.draft-note .draft-label {
  font-weight: 600;
}

.draft-note code,
.article-content code {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

mark.data-needed {
  padding: 0 0.2em;
  border-radius: 3px;
  background: #fbe7b5;
  color: #6b5320;
  font-size: 0.92em;
}

@media (max-width: 760px) {
  .artios-figure.is-wide,
  .article-wide-image.is-wide-image {
    width: 100%;
    margin-left: 0;
    transform: none;
  }

  /* Keep chart text legible on phones; the chart scrolls sideways instead. */
  .artios-figure .chart {
    overflow-x: auto;
  }

  .artios-figure .chart svg {
    min-width: 480px;
  }

  .artios-figure.is-wide .chart svg {
    min-width: 680px;
  }
}

/* Hold the Potts figure's height (viewBox 960 x 614) before its script runs, so the page does not shift. */
.chart[data-figure="fig-potts-model"] {
  aspect-ratio: 960 / 614;
}

/* Centre the Potts figure with margins rather than translateX(-50%): a transformed figure is snapped to the pixel
   grid separately from the text around it, and its fine lines appear to wobble while the page scrolls. */
#fig-potts-model.artios-figure.is-wide {
  margin-left: calc(50% - min(480px, 50vw - 1rem));
  transform: none;
}

@media (max-width: 760px) {
  /* The SVG is at least 680px wide here and scrolls sideways, so hold its height at that width. */
  #fig-potts-model.artios-figure.is-wide {
    margin-left: 0;
  }

  .chart[data-figure="fig-potts-model"] {
    aspect-ratio: auto;
    min-height: calc(680px * 614 / 960);
  }
}

/* Ligand-retention figure: a ligand colour key and three Mol* viewers (js/ligand-retention-figure.js). */
.lr-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.4rem;
  margin-bottom: 0.7rem;
  color: #3c3a36;
  font-size: 12.5px;
}

.lr-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.lr-swatch {
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
}

.lr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.lr-panel-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.lr-panel-letter {
  color: #1f1e1c;
  font-size: 17px;
  font-weight: 700;
}

.lr-panel-target {
  color: #1f1e1c;
  font-size: 14px;
  font-weight: 600;
}

.lr-panel-ligands {
  color: var(--fg4);
  font-size: 12.5px;
}

.lr-viewer-shell {
  position: relative;
  aspect-ratio: 1 / 1.04;
  overflow: hidden;
  border-radius: 6px;
  background: #ffffff;
}

.lr-viewer {
  position: absolute;
  inset: 0;
}

/* Mol* draws its own buttons in the viewport; the figure uses its legend and reset button instead. */
.lr-viewer .msp-viewport-controls,
.lr-viewer .msp-viewport-top-left-controls,
.lr-viewer .msp-highlight-toast-wrapper {
  display: none !important;
}

.lr-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fg4);
  font-size: 12.5px;
}

.lr-status[hidden],
.lr-reset[hidden] {
  display: none;
}

.lr-status[data-state="error"] {
  padding: 1rem;
  text-align: center;
}

.lr-reset {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--fg3);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.lr-reset:hover {
  color: var(--fg1);
  border-color: color-mix(in srgb, var(--fg4) 35%, transparent);
}

.lr-hint {
  margin: 0.5rem 0 0;
  color: var(--fg4);
  font-size: 12px;
  text-align: center;
}

.lr-fallback {
  display: block;
  width: 100%;
}

@media (max-width: 760px) {
  .lr-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
  }

  .lr-viewer-shell {
    aspect-ratio: 1 / 0.95;
  }
}
