/* El Niño Atlas stylesheet. Tokens come from tokens.css, generated from
   design/tokens.json; this file holds the rules. Dash serves every file
   in this folder in name order, so tokens.css loads first. */

/* ---------------------------------------------------------------- base */

html {
  font-size: var(--font-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-2));
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-md);
  font-family: var(--font-text);
  font-weight: 600;
  margin-top: var(--space-3);
  margin-bottom: var(--space-1);
}

p {
  margin: 0 0 var(--space-2);
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.12em;
  overflow-wrap: anywhere;
}

a:hover {
  text-decoration-thickness: 2px;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.prose {
  max-width: var(--measure);
}

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--target-min);
  min-width: var(--target-min);
  padding: 0 var(--space-2);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--easing),
    border-color var(--motion-fast) var(--easing),
    color var(--motion-fast) var(--easing);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn[aria-pressed="true"],
.btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
}

.btn--ghost:hover {
  border-color: var(--rule);
}

.select {
  min-height: var(--target-min);
  padding: 0 var(--space-4) 0 var(--space-2);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  max-width: 100%;
}

.check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 0 var(--space-1);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-muted);
  white-space: nowrap;
}

.schematic {
  max-width: 860px;
  margin: 0 auto;
}

.stamp {
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ----------------------------------------------------------- skip link */

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  transition: top var(--motion-fast) var(--easing);
}

.skip-link:focus {
  top: var(--space-1);
}

/* ---------------------------------------------------------- navigation */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: var(--hairline) solid var(--rule);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-2);
  min-height: var(--nav-height);
}

.site-nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  min-height: var(--target-min);
  display: inline-flex;
  align-items: center;
}

.site-nav__list {
  display: flex;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 auto;
}

.site-nav__list::-webkit-scrollbar {
  display: none;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--target-min);
  min-width: var(--target-min);
  padding: 0 var(--space-1);
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--motion-fast) var(--easing);
}

.site-nav__link:hover,
.site-nav__link.is-current {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.site-nav__toggle {
  margin-left: auto;
  color: var(--ink-muted);
}

.when-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-light {
    display: none;
  }

  :root:not([data-theme="light"]) .when-dark {
    display: inline;
  }
}

:root[data-theme="dark"] .when-light {
  display: none;
}

:root[data-theme="dark"] .when-dark {
  display: inline;
}

/* ---------------------------------------------------------------- page */

.atlas-page {
  min-height: 100vh;
}

.hero,
.main,
.footer {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.hero {
  padding-top: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: var(--hairline) solid var(--rule);
}

.hero__title {
  margin-bottom: var(--space-1);
}

.hero__maintainer {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

.hero__lead {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.4;
  max-width: 34em;
  margin-bottom: var(--space-2);
}

.hero__reading {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.hero__scope {
  color: var(--ink-muted);
  margin-bottom: 0;
}

.main {
  padding-bottom: var(--space-6);
}

.section {
  padding-top: var(--space-4);
}

.section__title {
  margin-bottom: var(--space-2);
}

/* ------------------------------------------------------- time controls */

.controls__group {
  display: inline-flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.controls__select {
  display: inline-flex;
  min-width: 0;
}

/* The band toggle: a pressed button drawn as a checkbox with its label. */
.controls__check {
  gap: var(--space-1);
  color: var(--ink);
}

.controls__check .check {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink-muted);
  border-radius: 3px;
  background: var(--surface);
  position: relative;
  flex: none;
}

.controls__check[aria-pressed="true"] .check {
  background: var(--accent);
  border-color: var(--accent);
}

.controls__check[aria-pressed="true"] .check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border-right: 2px solid var(--accent-ink);
  border-bottom: 2px solid var(--accent-ink);
  transform: rotate(45deg);
}

.controls__check[aria-pressed="true"] {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}

/* ---------------------------------------------------------------- card */

.card {
  margin-top: var(--space-4);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-3) var(--space-2);
}

.card__header {
  border-bottom: var(--hairline) solid var(--rule);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}

.card__stage {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-1);
}

.card__title {
  margin-bottom: var(--space-1);
}

.card__lede {
  font-size: var(--text-lg);
  font-family: var(--font-display);
  line-height: 1.35;
  max-width: 36em;
}

.card__source {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-bottom: var(--space-1);
}

.card__method {
  font-size: var(--text-sm);
  max-width: var(--measure);
}

.card__method summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.card__method summary::-webkit-details-marker {
  display: none;
}

.card__method summary::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: var(--space-1);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--motion-fast) var(--easing);
}

.card__method[open] summary::before {
  transform: rotate(45deg);
}

.card__how {
  margin-top: var(--space-1);
}

.card__note {
  font-size: var(--text-sm);
  margin: var(--space-1) 0 0;
}

.card__toolbars {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}

.card__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.card__toolbar--range .controls__select {
  flex: 1 1 14rem;
  max-width: 24rem;
}

.card__toolbar--range .select {
  width: 100%;
}

.card__toolbar-label {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-right: var(--space-1);
}

.card__figure {
  margin: 0;
  position: relative;
}

.card__body {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: var(--hairline) solid var(--rule);
}

.card__body h3:first-child {
  margin-top: 0;
}

.card__body p {
  margin-bottom: var(--space-1);
}

.card__body .caption {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  border-left: 2px solid var(--rule);
  padding-left: var(--space-1);
  margin-top: var(--space-2);
}

@media (min-width: 1024px) {
  .card {
    padding: var(--space-4) var(--space-4);
  }

  /* Label on the left, text on the right, as a definition list. */
  .card__body {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    column-gap: var(--space-4);
    row-gap: 0;
  }

  .card__body > * {
    max-width: var(--measure);
  }

  .card__body > h3 {
    margin-top: 0;
    padding-top: 2px;
  }

  .card__body > p {
    margin-bottom: var(--space-2);
  }

  .card__body > .caption {
    grid-column: 1 / -1;
    max-width: none;
    margin-top: 0;
  }
}

/* ------------------------------------------------------------- figures */

.dash-graph,
.js-plotly-plot,
.js-plotly-plot .plot-container {
  max-width: 100%;
}

.dash-graph {
  background: var(--surface);
}

/* Skeleton while plotly.js draws. */
.dash-graph:not(:has(.js-plotly-plot .main-svg)) {
  background: var(--skeleton);
  border-radius: var(--radius);
}

/* The mode bar sits in the toolbar row above the plot, at the right, with
   buttons at the touch-target size. */
.js-plotly-plot .modebar-container {
  top: calc(-1 * var(--target-min) - var(--space-1)) !important;
  right: 0 !important;
}

.js-plotly-plot .modebar {
  top: 0 !important;
  display: flex;
}

.js-plotly-plot .modebar-group {
  display: flex;
  padding: 0;
}

.js-plotly-plot .modebar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target-min);
  min-height: var(--target-min);
  border-radius: var(--radius);
}

.js-plotly-plot .modebar-btn svg {
  width: 1.1em;
  height: 1.1em;
}

.js-plotly-plot .modebar-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.js-plotly-plot .legend .traces:focus-visible {
  outline: 2px solid var(--focus);
}

/* ------------------------------------------------------------- notices */

.notice {
  padding: var(--space-2);
  border: var(--hairline) dashed var(--state-not-assessed);
  border-radius: var(--radius);
  color: var(--ink-muted);
  max-width: none;
}

.banner {
  padding: var(--space-2);
  border-radius: var(--radius);
  max-width: none;
  overflow-wrap: anywhere;
}

.banner--error {
  background: var(--error-surface);
  border: var(--hairline) solid var(--error);
  color: var(--error);
}

.banner--error code {
  color: inherit;
}

/* -------------------------------------------------------------- legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 28px;
}

.legend__swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex: none;
}

.legend__swatch--filled[data-state="alert"] {
  background: var(--state-alert);
}

.legend__swatch--outlined[data-state="no_alert"] {
  border: 2px solid var(--state-no-alert);
  background: transparent;
}

.legend__swatch--hatched[data-state="not_assessed"] {
  border: 1px dashed var(--state-not-assessed);
  background-image: repeating-linear-gradient(
    45deg,
    var(--state-not-assessed) 0 2px,
    transparent 2px 5px
  );
}

/* --------------------------------------------------------------- table */

.table-wrap {
  overflow-x: auto;
  margin-top: var(--space-2);
  border-top: var(--hairline) solid var(--rule);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-1);
  border-bottom: var(--hairline) solid var(--rule);
}

.table th {
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.table td a {
  min-height: var(--target-min);
  display: inline-flex;
  align-items: center;
}

/* ------------------------------------------------------------- sources */

.sources__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sources__list li {
  padding: var(--space-1) 0;
  border-bottom: var(--hairline) solid var(--rule);
}

.sources__list li > a {
  font-weight: 600;
}

.sources__list .card__source {
  margin-bottom: 0;
}

/* -------------------------------------------------------------- footer */

.footer {
  padding-top: var(--space-4);
  padding-bottom: var(--space-6);
  border-top: var(--hairline) solid var(--rule);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.footer__cite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.doi-badge {
  display: inline-flex;
  min-height: var(--target-min);
  align-items: stretch;
  text-decoration: none;
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
}

.doi-badge__label,
.doi-badge__value {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-1);
}

.doi-badge__label {
  background: var(--accent);
  color: var(--accent-ink);
}

.doi-badge__value {
  color: var(--ink);
}

.footer__status {
  font-weight: 600;
  color: var(--ink);
}

.footer__line {
  margin-bottom: var(--space-1);
}

.footer__build {
  margin-top: var(--space-2);
}

/* ------------------------------------------------------------ skeleton */

._dash-loading {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-2);
  color: transparent;
}

.skeleton {
  display: block;
  background: var(--skeleton);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
}

.skeleton--title {
  height: 44px;
  width: 40%;
}

.skeleton--line {
  height: 18px;
  width: 80%;
}

.skeleton--line.is-short {
  width: 55%;
}

.skeleton--card {
  height: 520px;
  margin-top: var(--space-4);
}

/* -------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* ---------------------------------------------------------- narrow screens */

@media (max-width: 767px) {
  .hero {
    padding-top: var(--space-4);
  }

  .hero__lead {
    font-size: var(--text-md);
  }

  .card {
    padding: var(--space-2) var(--space-1);
  }

  .card__lede {
    font-size: var(--text-md);
  }

  .site-nav__brand {
    display: none;
  }
}
