/* Borges / ARCIMBOLDO static site theme.
   A modern refresh of the original Rails theme, built on Bootstrap 5. */

:root {
  --brand:        #2b8fd0;
  --brand-light:  #4db1ea;
  --brand-dark:   #1c6fa6;
  --brand-darker: #14507a;
  --heading:      #15506f;
  --ink:          #1f2a33;
  --muted:        #5b6770;
  --line:         #e3e8ee;
  --bg-soft:      #f5f8fb;
  --table-border: #8a97a6;
  --table-head:   #e9eff5;
  --code-bg:      #f4f6f8;
  --code-border:  #b9c2cc;
}

html { scroll-behavior: smooth; }

body {
  padding-top: 64px;                 /* offset for the fixed navbar */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background-color: #fff;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: body fills the viewport so the footer is pinned to the
     bottom even on short pages (see footer.footer { margin-top: auto }). */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Every page's content lives in this single centred column, so the reading
   width and side margins are identical from page to page. */
#master-content {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
  width: 100%;
  max-width: 1280px;
}
/* Nested Bootstrap containers were doubling up padding/max-width and shifting
   content around between pages — flatten them so the grid aligns consistently. */
#master-content .container { max-width: 100%; padding-left: 0; padding-right: 0; }
section { overflow: auto; }

a { color: var(--brand-dark); text-underline-offset: 2px; }
a:hover { color: var(--brand-darker); }

/* ---- Navbar ---- */
.navbar.borges-nav {
  background-color: var(--brand);
  box-shadow: 0 2px 10px rgba(20, 80, 122, .18);
  padding-top: .4rem;
  padding-bottom: .4rem;
  align-items: center;
}
.navbar.borges-nav .navbar-brand {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.8rem;                 /* a little bigger than the menu items */
  line-height: 1;
  letter-spacing: .06em;
  margin-right: 1.75rem;
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;               /* keep it optically centred with the menu */
}
.navbar.borges-nav .navbar-brand:hover { color: #eaf6ff; }
.navbar.borges-nav .nav-link {
  color: #ffffff;
  font-weight: 500;
  font-size: 1.1rem;
  border-radius: 6px;
  padding-left: .7rem;
  padding-right: .7rem;
  transition: background-color .15s ease, color .15s ease;
}
.navbar.borges-nav .nav-link:hover,
.navbar.borges-nav .nav-link:focus,
.navbar.borges-nav .nav-link.show {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}
.navbar.borges-nav .dropdown-menu {
  background-color: var(--brand);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(20, 80, 122, .25);
  padding: .4rem;
  margin-top: .35rem;
}
.navbar.borges-nav .dropdown-item {
  border-radius: 6px;
  padding: .5rem .8rem;
  font-weight: 500;
  font-size: 1.05rem;
  color: #ffffff;
}
.navbar.borges-nav .dropdown-item:hover,
.navbar.borges-nav .dropdown-item:focus {
  background: var(--brand-darker);
  color: #fff;
}

/* ---- Mobile navbar (collapsed) ---- */
/* The menu carries many items (7 programs + Documentation + Tutorials +
   Download), so it collapses to a toggler below xxl (1400px) — the full
   horizontal bar only shows when there is genuinely room, so it never packs. */
@media (max-width: 1399.98px) {
  /* keep the expanded menu reachable under the fixed navbar */
  .navbar.borges-nav .navbar-collapse {
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    padding-bottom: .5rem;
  }
  /* dropdowns flow inline (no floating panel) and stay on-brand */
  .navbar.borges-nav .dropdown-menu {
    background-color: var(--brand-dark);
    box-shadow: none;
    margin: .15rem 0 .35rem;
    padding-left: .75rem;
  }
}

/* ---- Buttons ---- */
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-darker);
  --bs-btn-active-border-color: var(--brand-darker);
  --bs-btn-focus-shadow-rgb: 43, 143, 208;
  font-weight: 600;
  letter-spacing: .01em;
}
/* Flat buttons: only a small colour change on hover, no shadow "line". */

/* ---- Hero (was .hero-unit) ---- */
.hero {
  padding: 3rem 2rem;
  margin: .5rem auto 2.5rem;         /* centre the hero regardless of wrapper */
  max-width: 1000px;
  /* Deep gradient — deliberately darker than the navbar so the title box and
     the header read as two distinct elements. */
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-darker) 100%);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(20, 80, 122, .28);
}
.hero h1, .hero h2, .hero h3 { color: #fff; }
.hero h1 {
  font-size: clamp(2.6rem, 8vmin, 5rem);
  font-weight: 700;
  letter-spacing: .02em;
  padding-top: 0;
  margin-bottom: .5rem;
  text-align: center;
}
.hero h3 { font-weight: 400; opacity: .95; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 2.4rem;
  text-align: center;
  margin: 1.75rem 0 2rem;
}
h2 { font-size: 1.9rem; margin-top: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; line-height: 1.45; margin-top: 1.75rem; margin-bottom: 1rem; }
h4 { font-size: 1.25rem; line-height: 1.6; margin-bottom: 1rem; }
h5 { font-size: 1.1rem; margin-bottom: .75rem; }
/* Body-text spacing — scoped to the content area so the navbar/footer lists are untouched */
#master-content p,
#master-content li {
  font-size: 1.13rem;
  line-height: 1.8;
  margin-bottom: 1.1rem;
  color: var(--ink);
}
#master-content li { margin-bottom: .6rem; }
#master-content ul,
#master-content ol { margin-bottom: 1.25rem; }

.lead {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 400;                  /* normal weight, same letterform as body text */
  line-height: 1.7;
  color: var(--muted);
  padding: 0 10px;
  margin-bottom: 2rem;
}

/* Download-page item blocks: subtitle, description and button stacked in a
   column (no card), with slightly larger subtitle and text. */
#master-content .dl-item { margin-top: 1rem; }
#master-content .dl-item-title {
  color: var(--heading);
  font-size: 1.5rem;
  line-height: 1.3;
  margin-bottom: .5rem;
}
#master-content .dl-item-text {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1rem;
}

/* References list in tutorials — original layout (title, authors, then right-aligned DOI line) */
ol.references > li { margin-bottom: 1rem; line-height: 1.5; }
ol.references > li:last-child { margin-bottom: 0; }
ol.references strong { font-weight: 600; }
ol.references p { margin: .15rem 0 0; line-height: 1.4; }
/* Journal + DOI line: dark (not faded) and readable, in both reference styles */
ol.references small,
#master-content p.text-end small { font-size: .95em; color: var(--ink); }
#master-content p.text-end small a { font-weight: 500; }

/* Vertical rhythm between stacked content rows */
#master-content .row + .row { margin-top: 1.5rem; }
#master-content .hero + .container,
#master-content .hero + .row { margin-top: 1rem; }

/* ---- Images ---- */
/* never let an image (or wide code block) push the page wider than the viewport */
#master-content img { max-width: 100%; height: auto; }
#master-content table { max-width: 100%; overflow-x: auto; }
#master-content img.rounded,
#master-content img.img-fluid {
  border-radius: 12px;
}
#master-content img.rounded {
  box-shadow: 0 6px 20px rgba(20, 80, 122, .12);
}

/* ---- Code & configuration blocks ---- */
/* highlighted box for code snippets and .bor configuration / output files */
#master-content pre,
#master-content .CodeRay {
  max-width: 100%;
  overflow-x: auto;
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
  line-height: 1.55;
  color: #24323d;
}
#master-content .CodeRay pre {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
/* inline code */
#master-content code {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .9em;
  color: #b5267a;
}
/* code inside a highlighted block shouldn't get its own box */
#master-content pre code,
#master-content .CodeRay code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
}
/* Cards are informational containers (not whole-card links), so they stay
   static on hover — no lift or shadow line. */
.card-title { color: var(--heading); line-height: 1.3; margin-bottom: .35rem; }

/* ---- Tables ---- */
.table,
.table-alixe {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
  border: 1px solid var(--table-border);
  background-color: #fff;
}
.table th, .table td,
.table-alixe th, .table-alixe td {
  padding: .6rem .75rem;
  border: 1px solid var(--table-border);
  text-align: left;
  vertical-align: middle;
}
.table th,
.table-alixe th {
  background-color: var(--table-head);
  color: var(--heading);
  font-weight: 600;
}
.table tr:nth-child(even) td,
.table-alixe tr:nth-child(even) td { background-color: var(--bg-soft); }

@media (min-width: 768px) { .bigscreen { width: 25%; } }

#herohypo {
  padding: 5px;
  text-align: center;
  color: var(--brand-dark);
  font-family: inherit;
}

/* ---- Footer ---- */
footer.footer {
  margin-top: auto;                  /* sticky footer: pinned to the bottom */
  flex-shrink: 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
}
footer.footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}
footer.footer .footer-meta { font-size: .92rem; }
footer.footer a { color: var(--brand-dark); text-decoration: none; font-weight: 500; }
footer.footer a:hover { color: var(--brand-darker); }
footer.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* ---- Skip-to-content link (accessibility) ---- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 2000;
  background: var(--brand-darker);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- Active navbar entry ---- */
.navbar.borges-nav .nav-link.active {
  background: var(--brand-dark);
  color: #fff;
  font-weight: 600;
}
.navbar.borges-nav .dropdown-item.active { background: var(--brand-darker); }

/* ---- Back-to-top button ---- */
#back-to-top {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 1030;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(20, 80, 122, .35);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease;
}
#back-to-top:hover { background: var(--brand-dark); }
#back-to-top.show { opacity: 1; visibility: visible; transform: none; }

/* ---- Figure / table captions ---- */
#master-content .caption {
  text-align: center;
  font-size: .92rem;
  color: var(--muted);
  margin-top: .4rem;
}
