/* Site styles layered on top of the theme generated from _brand.yml.
   Colors come from Bootstrap CSS variables so light and dark mode both work. */

/* ---------- Fonts ----------
   _brand.yml loads the web fonts; these stacks add fallbacks so text never
   drops to a serif default while the fonts load or if they are blocked. */

:root {
  --bs-body-font-family: "News Cycle", "News Gothic MN", "Franklin Gothic Book", "Arial Narrow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-font-monospace: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body {
  font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, h6, .title, .topic-name {
  font-family: var(--bs-body-font-family);
  font-weight: 700;
}

code, pre, kbd, samp {
  font-family: var(--bs-font-monospace);
}

/* ---------- Navbar ----------
   Icons come from the `icon:` fields in _quarto.yml. The navbar is blue with
   light text in light mode and light blue with dark text in dark mode, so the
   hover and active highlights mix in currentColor and work in both. */

#quarto-header .navbar {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.navbar .nav-link {
  border-radius: 0.4rem;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.navbar .nav-link .bi,
.navbar .dropdown-item .bi {
  margin-right: 0.3rem;
}

.navbar .dropdown-item .bi {
  color: var(--bs-primary);
  width: 1.1rem;
  display: inline-block;
}

@media (min-width: 992px) {
  .navbar .nav-link:hover,
  .navbar .nav-link:focus-visible,
  .navbar .nav-link.show {
    background-color: color-mix(in srgb, currentColor 13%, transparent);
  }
  .navbar .nav-link.active {
    background-color: color-mix(in srgb, currentColor 20%, transparent);
  }
}

.navbar .dropdown-menu {
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.15);
  padding: 0.35rem;
}

.navbar .dropdown-item {
  border-radius: 0.35rem;
  padding: 0.35rem 0.7rem;
}

/* ---------- Page titles and headings ---------- */

#title-block-header .title {
  letter-spacing: -0.01em;
}

#title-block-header .description {
  font-size: 1.1rem;
  color: var(--bs-secondary-color);
}

main h2:not(.unlisted) {
  padding-bottom: 0.3rem;
  border-bottom: 2px solid rgba(var(--bs-primary-rgb), 0.25);
}

.callout {
  border-radius: 0.5rem;
}

/* "Show simulation code" and its language tabs. */
details.code-fold > summary {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
  cursor: pointer;
}

details.code-fold > summary:hover {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

details.code-fold[open] > summary {
  margin-bottom: 0.75rem;
}

.sim-code .panel-tabset .nav-tabs .nav-link {
  font-family: var(--bs-font-monospace);
  font-size: 0.85rem;
}

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

/* The home page draws its own hero, so hide both title-block wrappers Quarto
   emits for this combination of title and date metadata. */
.home-page #title-block-header {
  display: none !important;
}

/* A dark editorial hero makes the value proposition and primary action read
   first. The pale feature card previews the experience rather than asking a
   visitor to parse a full simulation before they know what the site is. */
.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(25rem, 0.92fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  overflow: hidden;
  margin: 0.75rem 0 1.5rem;
  padding: clamp(2.25rem, 5vw, 4.75rem);
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 8% 4%, rgba(158, 202, 225, 0.2), transparent 30%),
    radial-gradient(circle at 94% 96%, rgba(214, 96, 77, 0.24), transparent 34%),
    linear-gradient(135deg, #173f70 0%, #1d4e89 54%, #163b68 100%);
  box-shadow: 0 1.25rem 3rem rgba(15, 39, 70, 0.18);
  color: #fff;
}

.home-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  content: "";
  mask-image: linear-gradient(90deg, transparent 10%, #000 80%);
  opacity: 0.5;
}

.home-hero-copy {
  max-width: 43rem;
}

.home-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.home-hero h1.home-title {
  max-width: 12ch;
  margin: 1rem 0;
  border: 0;
  color: #fff;
  font-size: clamp(2.75rem, 5.2vw, 5rem);
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

.home-lead {
  display: block;
  max-width: 42rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  line-height: 1.45;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 1.65rem 0 1.4rem;
}

.home-actions p {
  display: contents;
}

.home-actions .btn {
  margin: 0;
  border-width: 2px;
  font-weight: 700;
}

.home-actions .btn-primary {
  border-color: #fff;
  background: #fff;
  color: #174272;
}

.home-actions .btn-primary:hover,
.home-actions .btn-primary:focus-visible {
  border-color: #fbfaf7;
  background: #fbfaf7;
  color: #102f54;
  transform: translateY(-1px);
}

.home-actions .btn-outline-light:hover,
.home-actions .btn-outline-light:focus-visible {
  color: #174272;
}

.home-random,
.home-about {
  color: rgba(255, 255, 255, 0.82);
  text-underline-offset: 0.2em;
}

.home-random {
  padding: 0.55rem 0.25rem;
  font-weight: 700;
}

.home-random:hover,
.home-random:focus-visible,
.home-about:hover,
.home-about:focus-visible {
  color: #fff;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-bottom: 1.45rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
}

.hero-proof span {
  display: inline-flex;
  gap: 0.3rem;
  align-items: baseline;
}

.hero-proof span + span::before {
  margin-right: 0.7rem;
  color: #f4a582;
  content: "•";
}

.hero-proof strong {
  color: #fff;
  font-size: 1.25rem;
}

.home-about {
  font-size: 0.9rem;
}

.home-hero .site-version {
  display: block;
  margin-top: 0.45rem;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
}

.home-feature {
  position: relative;
  padding: clamp(1.35rem, 2.4vw, 2rem);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 1rem;
  background: #fbfaf7;
  box-shadow:
    0.9rem 0.9rem 0 rgba(244, 165, 130, 0.28),
    0 1.25rem 2.5rem rgba(8, 29, 54, 0.3);
  color: #1f2328;
  transform: rotate(1deg);
}

.home-feature::before {
  position: absolute;
  z-index: -1;
  inset: -0.65rem 0.6rem 0.65rem -0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.1);
  content: "";
  transform: rotate(-3deg);
}

.feature-heading {
  display: flex;
  justify-content: space-between;
  color: #5c6670;
  font-family: var(--bs-font-monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-feature h2 {
  margin: 0.7rem 0 0.25rem;
  padding: 0;
  border: 0;
  color: #1d4e89;
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  line-height: 1.05;
}

.feature-deck {
  margin-bottom: 0.7rem;
  color: #4d5660;
  font-size: 1.02rem;
  line-height: 1.4;
}

.hero-chart {
  margin: 0;
}

.hero-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--bs-body-font-family);
}

.hero-band { fill: currentColor; opacity: 0.06; }
.hero-zero { stroke: currentColor; opacity: 0.35; }
.hero-tick, .hero-band-label { fill: currentColor; opacity: 0.75; font-size: 15px; }
.hero-legend { fill: currentColor; font-size: 17px; }
/* The open-circle key sits just left of its right-aligned label. */
.hero-legend-ring { transform: translateX(-132px); }

/* On phones the chart is ~330 px wide, so its text needs larger units. */
@media (max-width: 575.98px) {
  .hero-tick, .hero-band-label { font-size: 24px; }
  .hero-legend, .hero-truth-label { font-size: 26px; }
  .hero-legend-ring { transform: translateX(-200px); }
}
.hero-truth { stroke: var(--bs-primary); stroke-width: 2.5; }
.hero-truth-label { fill: var(--bs-primary); font-size: 17px; font-weight: 700; }

/* Labels get a halo in the page color so dots behind them don't hide them. */
.hero-truth-label, .hero-band-label {
  paint-order: stroke;
  stroke: #fbfaf7;
  stroke-width: 5px;
  stroke-linejoin: round;
}

/* The dots drop in left to right; the significant ones swell as they land. */
.hero-dot {
  fill: none;
  stroke: #8a8a8a;
  stroke-width: 1.4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: hero-drop 0.45s ease-out forwards;
  animation-delay: calc(var(--i) * 14ms);
}

.hero-dot.sig {
  fill: #d6604d;
  stroke: none;
  animation-name: hero-drop-sig;
  animation-duration: 0.7s;
}

@keyframes hero-drop {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: none; }
}

@keyframes hero-drop-sig {
  0% { opacity: 0; transform: translateY(-16px) scale(1); }
  60% { opacity: 1; transform: translateY(0) scale(1.7); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-dot, .hero-dot.sig { animation: none; opacity: 1; }
}

.hero-chart figcaption {
  margin-top: 0.35rem;
  color: #5c6670;
  font-size: 0.86rem;
  line-height: 1.35;
}

.feature-link {
  display: inline-block;
  margin-top: 0.7rem;
  color: #1d4e89;
  font-weight: 700;
  text-decoration: none;
}

.feature-link:hover,
.feature-link:focus-visible {
  color: #14375f;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 1099.98px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-hero-copy {
    max-width: 50rem;
  }

  .home-feature {
    max-width: 43rem;
  }
}

@media (max-width: 575.98px) {
  .home-hero {
    gap: 2.25rem;
    margin-inline: -0.55rem;
    padding: 1.6rem 1.15rem 2rem;
    border-radius: 1.1rem;
  }

  .home-hero h1.home-title {
    font-size: clamp(2.55rem, 13vw, 3.3rem);
  }

  .home-actions {
    align-items: stretch;
  }

  .home-actions .btn {
    flex: 1 1 100%;
  }

  .home-random {
    flex-basis: 100%;
    text-align: center;
  }

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

  .hero-proof span {
    display: block;
    line-height: 1.2;
  }

  .hero-proof span + span::before {
    content: none;
  }

  .hero-proof strong {
    display: block;
  }

  .home-feature {
    padding: 1.15rem;
    transform: none;
  }

  .home-feature::before {
    display: none;
  }
}

/* Entry of the day. */
.home-today {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 1.5rem;
  align-items: center;
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-left: 5px solid #d6604d;
  border-radius: 0.8rem;
  background: var(--bs-body-bg);
}

.home-today[hidden] {
  display: none;
}

.today-label {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b5452f; /* the brand red, darkened to 5.2:1 for small text */
}

.quarto-dark .today-label {
  color: #e8846f; /* 6.8:1 on the dark background */
}

.today-num {
  margin-right: 0.4rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
}

.today-title {
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
}

.today-def {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.08rem;
}

.today-tags {
  margin: 0;
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

@media (max-width: 767.98px) {
  .home-today {
    grid-template-columns: minmax(0, 1fr);
  }
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 2.5rem;
}

/* Pandoc may wrap the cards in a paragraph; let them flow into the grid. */
.topic-grid > p {
  display: contents;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid var(--bs-primary);
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.12);
  color: var(--bs-body-color);
}

/* Kind cards use the accent color so they read as a second axis. */
.kind-card {
  border-left-color: var(--bs-danger);
}

.kind-card .topic-name {
  color: var(--bs-danger);
}

.topic-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bs-primary);
}

.topic-icon {
  margin-right: 0.45rem;
}

.topic-count {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
}

.topic-desc {
  font-size: 0.93rem;
}

/* Listing table: keep the definition column readable. */
.quarto-listing-table td.listing-description {
  max-width: 38rem;
}

.quarto-listing-table td.listing-order {
  font-variant-numeric: tabular-nums;
  color: var(--bs-secondary-color);
}

/* On phones, show each row of the full table as a stacked card instead of a
   four-column table that would need sideways scrolling. */
@media (max-width: 576px) {
  .quarto-listing-table thead {
    display: none;
  }
  .quarto-listing-table,
  .quarto-listing-table tbody,
  .quarto-listing-table tr,
  .quarto-listing-table td {
    display: block;
    width: 100%;
  }
  .quarto-listing-table tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bs-border-color);
  }
  .quarto-listing-table td {
    border: 0;
    padding: 0.1rem 0;
    max-width: none;
  }
  .quarto-listing-table td.listing-order::before {
    content: "#";
  }
}

/* Grid cards on topic pages. */
.quarto-grid-item .listing-description {
  font-size: 0.92rem;
}

/* ---------- Sidebar ---------- */

#quarto-sidebar .sidebar-item-text {
  font-size: 0.88rem;
}

/* ---------- Entry pages ---------- */

.lexicon-source {
  font-size: 0.9rem;
}

.takeaways li {
  margin-bottom: 0.35rem;
}

.observablehq form {
  margin-bottom: 0.35rem;
}

/* Wider labels for Observable Inputs so slider captions don't wrap into a
   narrow column. Inputs sets --label-width on each form (class "oi-..."),
   so target the form itself with higher specificity. */
.cell-output-display form[class^="oi-"],
.observablehq form[class^="oi-"] {
  --label-width: 15rem;
}

@media (max-width: 576px) {
  .cell-output-display form[class^="oi-"],
  .observablehq form[class^="oi-"] {
    --label-width: 9rem;
  }
}

.observablehq figure,
.cell-output-display svg {
  max-width: 100%;
}

.sim-readout {
  border-left: 4px solid var(--bs-primary);
  padding: 0.5rem 0.9rem;
  margin: 0.75rem 0 1.25rem;
  background: rgba(var(--bs-primary-rgb), 0.07);
  border-radius: 0 0.35rem 0.35rem 0;
}

/* Simulation tools (_sim-tools.html): reset, download, run in the browser. */
.sim-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.75rem;
}

.sim-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: 0.9rem;
  cursor: pointer;
}

.sim-tool:hover,
.sim-tool:focus-visible {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.sim-tool:disabled {
  opacity: 0.6;
  cursor: progress;
}

.sim-run {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--bs-border-color);
}

.sim-run-note {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

.sim-run-output img {
  display: block;
  max-width: 100%;
  margin: 0.5rem 0;
  background: #fff;
  border-radius: 0.35rem;
}

.sim-run-text {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.sim-run-status {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
}

/* Wide display equations scroll inside their own box on phones instead of
   widening the page. */
mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Contrast and touch targets (Lighthouse). Quarto dims category tags with
   opacity .6 (4.2:1); the theme's secondary text color passes 4.5:1 in both
   modes. The same color for the previous/next links, and a 24 px tall
   breadcrumb link. */
.quarto-title .quarto-categories .quarto-category,
.quarto-categories .quarto-category {
  opacity: 1;
  color: var(--bs-secondary-color);
}

.nav-page .nav-page-text {
  color: var(--bs-secondary-color);
}

.quarto-page-breadcrumbs .breadcrumb-item a {
  display: inline-block;
  min-height: 24px;
  line-height: 24px;
}

/* ---------- About page: multi-model workflow depiction ---------- */

.model-loop {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.85rem;
  background: rgba(var(--bs-primary-rgb), 0.03);
}

.model-loop-lead {
  max-width: 34rem;
  margin: 0 auto;
}

.model-loop-arrow {
  margin: 0.6rem 0;
  text-align: center;
  font-family: var(--bs-font-monospace);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
}

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

.model-node {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-top: 4px solid var(--bs-primary);
  border-radius: 0.55rem;
  background: var(--bs-body-bg);
  font-size: 0.92rem;
  line-height: 1.4;
}

.model-node strong {
  font-size: 1.08rem;
}

.model-badge {
  font-family: var(--bs-font-monospace);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
}

.model-human {
  border-top-color: #1d4e89;
  text-align: center;
}

.model-claude {
  border-top-color: #2166ac;
}

.model-codex {
  border-top-color: #d6604d;
}

.model-gemini {
  border-top-color: #1a9850;
}

.model-loop-gate {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.9rem;
  padding: 0.6rem 0.9rem;
  border: 1px dashed var(--bs-border-color);
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

@media (max-width: 767.98px) {
  .model-loop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Try it in R labs ---------- */

.lab-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid var(--bs-primary);
  border-radius: 0.5rem;
  background: rgba(var(--bs-primary-rgb), 0.05);
  font-size: 0.92rem;
}

.lab-experiments {
  padding: 0.85rem 1.1rem;
  margin: 0.85rem 0 1.35rem;
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid #1a9850;
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
}

.lab-experiments strong.lab-exp-title {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: #1a9850;
}

.quarto-dark .lab-experiments strong.lab-exp-title {
  color: #66c2a5;
}

.lab-experiments ol {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.lab-experiments li {
  margin-bottom: 0.35rem;
}

.lab-experiments li:last-child {
  margin-bottom: 0;
}

/* Editable script box inside _sim-tools.html */
.sim-run-editor {
  display: block;
  width: 100%;
  min-height: 11rem;
  margin-top: 0.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.4rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: var(--bs-font-monospace);
  font-size: 0.82rem;
  line-height: 1.4;
  resize: vertical;
}

.sim-run-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
