/*
 * gifter documentation theme
 *
 * Keep these design tokens aligned with inst/templates/database-report.css.
 * The documentation and database atlas have different generated markup, but
 * they should feel like two rooms in the same application.
 */
:root {
  --ink: #173330;
  --muted: #687672;
  --paper: #f6f3ec;
  --surface: #fffdf8;
  --line: #dcded5;
  --forest: #0d3d38;
  --forest-2: #18564e;
  --mint: #90c9b5;
  --mint-pale: #dceee6;
  --coral: #ef765d;
  --coral-pale: #fbe2dc;
  --gold: #d9a936;
  --gold-pale: #f5e9c3;
  --blue: #477e91;
  --shadow: 0 16px 50px rgba(23, 51, 48, .08);

  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-link-color: var(--forest-2);
  --bs-link-hover-color: var(--forest);
  --bs-code-color: #a74937;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-height: 100vh;
  padding-top: 74px;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(144, 201, 181, .2), transparent 26rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration-color: rgba(24, 86, 78, .35);
  text-underline-offset: .16em;
}

a:hover { text-decoration-color: currentColor; }

/* Shared application header ------------------------------------------------ */

.navbar {
  min-height: 74px;
  padding: 10px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(23, 51, 48, .12);
  background: rgba(246, 243, 236, .92) !important;
  box-shadow: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.navbar > .container {
  display: grid;
  width: 100%;
  max-width: none;
  padding: 0;
  grid-template-columns: minmax(180px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 24px;
}

.navbar-brand {
  display: grid;
  width: max-content;
  min-width: 128px;
  margin: 0 !important;
  grid-template-columns: 34px auto;
  grid-template-rows: 20px 11px;
  column-gap: 10px;
  align-items: center;
  color: var(--forest) !important;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.04em;
  line-height: 1;
  text-decoration: none;
}

.navbar-brand::before {
  width: 34px;
  height: 34px;
  grid-column: 1;
  grid-row: 1 / span 2;
  background: url("logo.svg") center / contain no-repeat;
  content: "";
}

.gifter-wordmark {
  grid-column: 2;
  grid-row: 1;
}

.gifter-wordmark-suffix {
  color: var(--muted);
}

.navbar-brand::after {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: var(--muted);
  content: "documentation";
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .16em;
  line-height: 1;
  text-transform: uppercase;
}

.navbar .nav-text {
  display: none;
}

.navbar-collapse {
  min-width: 0;
}

.navbar.headroom {
  transform: none !important;
  transition: none;
}

.navbar .navbar-nav.me-auto {
  display: flex;
  grid-column: 2;
  justify-self: center;
  padding: 4px;
  border: 1px solid rgba(23, 51, 48, .12);
  border-radius: 11px;
  background: rgba(255, 253, 248, .7);
}

.navbar .nav-link {
  padding: 8px 13px !important;
  border-radius: 8px;
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
  transition: color .18s, background .18s, box-shadow .18s;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.show {
  color: var(--forest) !important;
}

.navbar .nav-link.active,
.navbar .nav-item.active > .nav-link,
.navbar .nav-link[aria-current="page"] {
  color: var(--forest) !important;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(23, 51, 48, .09);
}

.navbar .dropdown-menu {
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.navbar .dropdown-item {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  color: var(--forest);
  background: var(--mint-pale);
}

.navbar form[role="search"] {
  position: relative;
  width: 100%;
  margin-left: 0;
}

.navbar .navbar-nav:last-child > .nav-item:has(form[role="search"]) {
  width: min(22vw, 320px);
}

.navbar .navbar-nav:last-child {
  display: flex;
  grid-column: 3;
  flex-direction: row;
  justify-self: end;
  align-items: center;
  gap: 16px;
}

.navbar form[role="search"]::before {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 13px;
  color: var(--forest-2);
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
}

.navbar #search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 37px;
  border: 1px solid rgba(23, 51, 48, .16);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  transition: border .18s, box-shadow .18s;
}

.navbar form[role="search"] .algolia-autocomplete {
  display: block !important;
  width: 100%;
}

.navbar #search-input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(144, 201, 181, .2);
}

.navbar #search-input::placeholder { color: #8a9692; }

.navbar .fa-github {
  color: var(--forest);
  font-size: 18px;
}

.navbar-toggler {
  border-color: rgba(23, 51, 48, .18);
  border-radius: 9px;
  color: var(--forest);
}

/* Documentation content --------------------------------------------------- */

body > .container {
  width: min(1380px, 100%);
  max-width: none;
  padding: 20px clamp(20px, 4vw, 64px) 80px;
}

/* The home page has no breadcrumbs, so it keeps its own space above the title. */
body > .container.template-home { padding-top: 48px; }

main { min-width: 0; }

/* Breadcrumbs: a rounded box 20px below the navbar and 20px above the page
   title. One line: a long title is cut short, not wrapped. */
.gifter-breadcrumbs {
  display: flex;
  margin: 0 0 20px;
}

.gifter-breadcrumbs ol {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(23, 51, 48, .05);
  font-size: 12px;
  line-height: 18px;
  list-style: none;
  white-space: nowrap;
}

/* The page header's own top margin would otherwise win over the 20px. */
.gifter-breadcrumbs + .page-header { margin-top: 0; }

.gifter-breadcrumbs li { flex: 0 0 auto; }

.gifter-breadcrumbs li + li::before {
  margin: 0 8px;
  color: var(--forest-2);
  content: "\2192";
}

.gifter-breadcrumbs li:last-child {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--forest);
  font-weight: 700;
  text-overflow: ellipsis;
}

.gifter-breadcrumbs a { color: var(--muted); text-decoration: none; }
.gifter-breadcrumbs a:hover,
.gifter-breadcrumbs a:focus { color: var(--forest); text-decoration: underline; }

.row > main,
.row > aside { margin-top: 0; }

h1, h2, h3, h4, h5,
.h1, .h2, .h3, .h4, .h5 {
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -.025em;
}

h1, .h1 {
  font-size: clamp(38px, 4vw, 54px);
  letter-spacing: -.045em;
  line-height: 1.02;
}

h2, .h2 {
  margin-top: 3.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: clamp(27px, 2.6vw, 36px);
}

h3, .h3 {
  margin-top: 2.2rem;
  font-size: 24px;
}

.page-header {
  margin-bottom: 22px;
  padding: 0 0 18px;
  border-bottom: 0;
}

.page-header h1 { margin: 0; }

.template-home .page-header { min-height: 0; }

.page-header + p,
.template-home .page-header + p {
  max-width: 800px;
  color: var(--muted);
  font-size: 18px;
}

.anchor {
  color: var(--mint) !important;
  text-decoration: none;
}

code {
  padding: .08em .28em;
  border-radius: 4px;
  color: #a74937;
  background: var(--coral-pale);
  font-size: .9em;
}

pre,
div.sourceCode {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface) !important;
  box-shadow: 0 8px 28px rgba(23, 51, 48, .05);
}

pre {
  padding: 16px 18px;
  color: var(--ink);
}

pre code,
div.sourceCode code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.sourceCode pre {
  border: 0;
  border-radius: inherit;
  box-shadow: none;
}

blockquote {
  padding: 14px 18px;
  border-left: 3px solid var(--coral);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  background: var(--coral-pale);
}

.table,
table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-border-color: var(--line);
  overflow: hidden;
  border-color: var(--line);
  border-radius: 12px;
}

.table thead th,
table thead th {
  color: var(--forest);
  background: rgba(220, 238, 230, .65);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .02em;
}

.table tbody tr:hover,
table tbody tr:hover { background: rgba(220, 238, 230, .32); }

.btn-primary {
  --bs-btn-color: #fffdf8;
  --bs-btn-bg: var(--forest);
  --bs-btn-border-color: var(--forest);
  --bs-btn-hover-color: #fffdf8;
  --bs-btn-hover-bg: var(--forest-2);
  --bs-btn-hover-border-color: var(--forest-2);
  border-radius: 9px;
}

.alert {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
}

aside > div,
.template-reference-index .ref-index th,
.template-article #toc {
  border-top: 1px solid var(--line);
}

aside > div {
  margin-bottom: 28px;
  padding-top: 15px;
}

aside h2,
.template-article #toc h2 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  color: var(--coral);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

aside a,
#toc a { color: var(--muted); }

aside a:hover,
#toc a:hover,
#toc .active > a { color: var(--forest); }

#toc .active > a {
  border-radius: 8px;
  background: var(--mint-pale);
}

.list-unstyled li { margin-bottom: 7px; }

footer {
  margin-top: 72px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

footer a { color: var(--forest-2); }

/* Search results inherit the same lightweight surface language. */
.algolia-autocomplete .aa-dropdown-menu {
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow) !important;
}

@media (min-width: 992px) {
  .navbar.navbar-expand-lg .navbar-collapse { display: contents !important; }
}

@media (max-width: 991.98px) {
  body { padding-top: 66px; }

  .navbar {
    min-height: 66px;
    padding-block: 8px;
  }

  .navbar > .container {
    display: flex;
    gap: 0;
  }

  .navbar .nav-text { margin-right: auto !important; }

  .navbar-collapse {
    max-height: calc(100vh - 76px);
    margin: 10px -8px 0 !important;
    padding: 10px 8px 6px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
  }

  .navbar .navbar-nav.me-auto {
    align-items: stretch;
    border: 0;
    background: transparent;
  }

  .navbar form[role="search"] {
    width: 100%;
    margin: 10px 0 4px;
  }

  .navbar .navbar-nav:last-child > .nav-item:has(form[role="search"]) {
    width: 100%;
  }

  .navbar .navbar-nav:last-child {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  body > .container { padding-top: 36px; }
}

@media (max-width: 575.98px) {
  .navbar-brand { min-width: 118px; }
  .navbar .nav-text { display: none; }

  body > .container {
    padding-inline: 18px;
    padding-bottom: 56px;
  }

  h1, .h1 { font-size: 38px; }
  h2, .h2 { font-size: 28px; }
}

@media print {
  body {
    padding-top: 0;
    background: #fff;
  }

  .navbar, .gifter-breadcrumbs { display: none; }

  body > .container {
    width: 100%;
    padding: 0;
  }
}

/* Case studies ------------------------------------------------------------- */

.case-summary {
  margin: 28px 0 34px;
  padding: clamp(20px, 3vw, 28px) clamp(22px, 3vw, 32px);
  border: 1px solid #b8d7cb;
  border-left: 5px solid var(--forest-2);
  border-radius: 14px;
  background: linear-gradient(120deg, var(--mint-pale), var(--surface) 75%);
  box-shadow: 0 10px 28px rgba(23, 51, 48, .05);
}

.case-summary > p:first-child {
  margin: 0 0 14px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.case-summary > p:first-child strong { font-weight: inherit; }

.case-summary ul { margin: 0; padding-left: 1.25rem; }
.case-summary li { padding-left: .25rem; }
.case-summary li + li { margin-top: .65rem; }
.case-summary li::marker { color: var(--forest-2); }

.case-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 24px 0 28px;
}

.case-stats > div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.case-stats strong {
  display: block;
  color: var(--forest);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
}

.case-stats span {
  color: var(--muted);
  font-size: 12.5px;
}

/* A figure is a card that opens its full-resolution file. */
a.case-figure {
  display: block;
  margin: 26px 0 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: zoom-in;
}

a.case-figure img {
  display: block;
  width: 100%;
  height: auto;
}

a.case-figure .figure { margin: 0; }

a.case-figure .caption,
a.case-figure figcaption {
  margin: 10px 6px 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  text-align: left;
}
