/* This site's own styles, on top of the theme */

/* Titles in the old site's font */
h1 {
  font-family: "Open Sans", sans-serif;
  font-weight: 800;
}

/* Subtitles in regular weight, not the theme's light */
.post-desc.fw-light {
  font-weight: 400 !important;
}

/* The theme sizes the sidebar photo in px but its circle in rem */
#avatar img {
  width: 100%;
  height: 100%;
}

/* :root is doubled to outrank the theme's own settings.
   Bigger text everywhere, as the theme sizes nearly everything in rem (default 16px).
   Green accent, from the favicon (#6ec45f). That's too pale for links on white, so
   light mode uses a darker shade. */
:root:root {
  font-size: 18px;
  --accent: #2f7722;
  --accent-hover: #205a16;
  --link-color: var(--accent);
  --link-underline-color: #bfe0b9;
  --toc-highlight: var(--accent);
  --btn-share-hover-color: var(--accent);
  --sidebar-active-color: var(--accent);
  --sidebar-hover-bg: color-mix(in srgb, var(--accent) 8%, transparent);
}
:root[data-bs-theme="dark"] {
  --accent: #6ec45f;
  --accent-hover: #9fdb94;
  --link-underline-color: #3f6b38;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme]) {
    --accent: #6ec45f;
    --accent-hover: #9fdb94;
    --link-underline-color: #3f6b38;
  }
}

/* The current page in the sidebar, a little greener than a hovered one */
#sidebar ul li.nav-item.active a.nav-link {
  background-color: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* The theme hardcodes an orange hover on these links */
#page-category a:hover,
#page-tag a:hover,
#access-lastmod a:hover,
.post-tail-wrapper .license-wrapper > a:hover,
.post-edit > a:hover,
#search-results a:hover,
footer a:hover,
#topbar #breadcrumb a:hover,
.post-meta a:not([class]):hover,
.content a:not(.img-link):hover {
  border-bottom-color: var(--accent-hover);
  color: var(--accent-hover) !important;
}

/* White text needs the darker green in both modes */
.btn-primary {
  --bs-btn-bg: #2f7722;
  --bs-btn-border-color: #2f7722;
  --bs-btn-hover-bg: #266a1b;
  --bs-btn-hover-border-color: #266a1b;
  --bs-btn-active-bg: #205a16;
  --bs-btn-active-border-color: #205a16;
  --bs-btn-disabled-bg: #2f7722;
  --bs-btn-disabled-border-color: #2f7722;
  --bs-btn-focus-shadow-rgb: 47, 119, 34;
}
/* LinkedIn's own blue */
.btn-linkedin {
  --bs-btn-color: #fff;
  --bs-btn-bg: #0a66c2;
  --bs-btn-border-color: #0a66c2;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #004182;
  --bs-btn-hover-border-color: #004182;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #00336a;
  --bs-btn-active-border-color: #00336a;
  --bs-btn-focus-shadow-rgb: 10, 102, 194;
}
/* Keep these buttons in posts and pages free of the link underline and hover colour */
.content a:is(.btn-primary, .btn-linkedin) {
  border-bottom-color: var(--bs-btn-border-color);
}
.content a:is(.btn-primary, .btn-linkedin):hover {
  border-bottom-color: var(--bs-btn-hover-border-color);
  color: var(--bs-btn-hover-color) !important;
}

/* The Bootstrap 3 classes still used in post and page markup. The theme's
   production CSS only keeps the Bootstrap classes the theme itself uses. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.center-block {
  display: block;
  margin-inline: auto;
}
.center-block img {
  margin-inline: auto;
}
.pull-right {
  float: right;
}
.img-circle {
  border-radius: 50%;
}
.list-inline {
  list-style: none;
  padding-left: 0;
}
.list-inline > li {
  display: inline-block;
  padding-inline: 0.25rem;
}
@media (min-width: 576px) {
  .col-sm-offset-1 {
    margin-left: 8.33%;
  }
}
.jumbotron {
  padding: 1.5rem;
  border-radius: 0.5rem;
  background: var(--card-bg);
}
.alert-info {
  background: var(--prompt-info-bg);
}
.alert-warning {
  background: var(--prompt-warning-bg);
}
.alert-danger {
  background: var(--prompt-danger-bg);
}
.btn-default {
  border: 1px solid var(--btn-border-color);
}
.form-group,
.radio {
  margin-bottom: 0.75rem;
}
.form-inline .form-control {
  display: inline-block;
  width: auto;
}
.pre-scrollable {
  max-height: 340px;
  overflow-y: auto;
}
.table-bordered :is(th, td) {
  border: 1px solid var(--tb-border-color);
}

/* Sizing for images in posts */
.golden-width img {
  width: 61.8%;
}
.height-fits img {
  width: auto;
  height: 500px;
}

/* Right-aligned number columns in investing tables */
table.right-figures tr :is(th, td):nth-of-type(n + 2),
table.right-figures-3 tr :is(th, td):nth-of-type(n + 3) {
  text-align: right;
}

/* Set by _includes/page-sharing.html where no script handles this button */
.no-copy-link #copy-link {
  display: none;
}

/* The site name in the top bar, shown on phones and tablets, links home with my photo */
#topbar-title a {
  color: inherit;
}
/* So pages keep their title on phones and tablets too, under the site's name, as posts do.
   The theme hides it there as its top bar shows the title instead. */
h1.dynamic-title {
  display: block !important;
}
h1.dynamic-title ~ .content {
  margin-top: 0 !important;
}
#topbar-title .with-photo::before {
  content: "";
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: url("../img/eusebius-avatar-icon.jpg") center / cover;
  vertical-align: middle;
}

/* Homepage cover. _ts/home-cover.ts adds the photos. */
.home-cover {
  position: relative;
  width: 100%; /* or min-height widens it to keep the aspect ratio */
  aspect-ratio: 21 / 9;
  min-height: 14rem;
  margin-block: 1rem 2rem;
  overflow: hidden;
  border-radius: 0.625rem;
  background: #1b1b1e;
}
.home-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s;
}
.home-cover img.is-shown {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .home-cover img {
    transition: none;
  }
}
.home-cover-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-inline: 1.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.15));
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.home-cover-text h1 {
  margin: 0;
  color: inherit;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 800;
}
.home-cover-text p {
  margin: 0.5rem 0 0;
  font-size: clamp(0.85rem, 1.6vw, 1.125rem);
}
.home-cover-caption {
  position: absolute;
  inset: auto 0 0;
  margin: 0;
  padding: 0.5rem 1rem;
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
