/* ============ Header tuning knobs ============ */
header.cover {
  --hdr-weight: 400;
  --hdr-shadow: 0 1px 4px rgba(0,0,0,.65), 0 2px 14px rgba(0,0,0,.5);
  --hdr-shadow-hover: 0 1px 4px rgba(0,0,0,.65), 0 0 10px rgba(255,255,255,.4);
  --hdr-glow: drop-shadow(0 1px 3px rgba(0,0,0,.65)) drop-shadow(0 2px 8px rgba(0,0,0,.5));
  --hdr-rest: rgba(255,255,255,.75);
  --hdr-hover: #fff;
}

/* Overlay */
header.cover .bg-black-60 {
  background: linear-gradient(to bottom,
    rgba(0,0,0,.55) 0%,
    rgba(0,0,0,.35) 45%,
    rgba(0,0,0,.45) 100%);
}

/* Text: title (div or h1), site name, Articles */
header.cover .bg-black-60 .fw2,
header.cover .bg-black-60 nav a:not(.ananke-social-link) {
  font-weight: var(--hdr-weight) !important;
  color: var(--hdr-rest) !important;
  text-shadow: var(--hdr-shadow) !important;
  transition: color .15s ease, text-shadow .15s ease;
}

/* Nav link hover/focus */
header.cover .bg-black-60 nav a:not(.ananke-social-link):hover,
header.cover .bg-black-60 nav a:not(.ananke-social-link):focus-visible {
  color: var(--hdr-hover) !important;
  text-shadow: var(--hdr-shadow-hover) !important;
}

/* Social icons */
header.cover .ananke-social-link {
  filter: var(--hdr-glow);
  opacity: .85;
  transition: opacity .15s ease;
}
header.cover .ananke-social-link:hover,
header.cover .ananke-social-link:focus-visible {
  opacity: 1;
}

/* Featured Image Alignment */
header.cover.bg-top { background-position: center; }

/* Search button */
header.cover .pf-trigger-btn {
  position: relative;
  filter: var(--hdr-glow);
  background: transparent !important;
  border-radius: 50% !important;
  border: 0 !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center !important;
  transition: background-color .15s ease !important;
}

/* Invisible 44px touch target around the 36px circle */
header.cover .pf-trigger-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
}

@media (hover: hover) {
  header.cover .pf-trigger-btn:hover {
    background: rgba(255,255,255,.22) !important;
  }
}

header.cover .pf-trigger-btn:focus-visible {
  background: rgba(255,255,255,.22) !important;
}

header.cover .pf-trigger-icon {
  background-color: #fff;
  filter: brightness(0) invert(1);
}

/* Wrapper spacing + vertical centering */
.nav-search {
  display: flex;
  align-items: center;
  margin-inline-end: .30rem;
}

@media screen and (min-width: 60em) {
  .nav-search { margin-inline-start: 0; }

  /* Pull "Articles" closer to the search button */
  header.cover nav ul { margin-right: 0 !important; }
  header.cover nav ul li { padding-right: .5rem !important; }
}

header.cover .ananke-socials,
footer .ananke-socials {
  display: flex;
  align-items: center;
}

header.cover .ananke-socials a,
footer .ananke-socials a {
  display: flex;
  align-items: center;
}

/* ============= Mobile Fixes ============ */

/* Phone only: pull the search icon in line with the left text edge */
@media screen and (max-width: 59.99em) {
  .nav-search { margin-inline-start: -0.4rem; }
}

/* ============ Fix social icon offset on phones ============ */
header.cover .ananke-social-link,
footer .ananke-social-link {
  padding-top: 0 !important;
}

@media screen and (max-width: 59.99em) {
  header.cover .nav-search,
  header.cover .ananke-socials { margin-top: .5rem; }
}

/* ============ Mobile overflow safety net ============ */
article pre { overflow-x: auto; max-width: 100%; }
article img, article video { max-width: 100%; height: auto; }
article iframe { max-width: 100%; }
article .nested-links { overflow-wrap: break-word; }
article table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/* Consistent header height on phones: all pages */
@media screen and (max-width: 59.99em) {
  header.cover {
    display: flex;
    flex-direction: column;
    min-height: 19.5rem;
  }
  header.cover > .bg-black-60 {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  header.cover > .bg-black-60 > div:last-child {
    margin-top: auto;
  }

  /* Posts only: tighter title block, smaller title, darker lower overlay */
  body.is-page header.cover > .bg-black-60 {
    background: linear-gradient(to bottom,
      rgba(0,0,0,.45) 0%,
      rgba(0,0,0,.45) 50%,
      rgba(0,0,0,.65) 100%);
  }
  body.is-page header.cover > .bg-black-60 > div:last-child {
    padding-top: 1rem;
    padding-bottom: 2rem;
  }
  body.is-page header.cover > .bg-black-60 > div:last-child > div:first-child {
    font-size: 1.75rem;
  }
}

/* ============ Code ============ */
pre {
  font-size: 0.9em;
  line-height: 1.5;
}
pre code {
  font-size: inherit;
}
:not(pre) > code,
kbd,
samp {
  font-size: 0.9em;
  padding: 0.2em 0.4em;
}

/* ============ Article body text ============ */
article .nested-copy-line-height {
  font-size: 1.125rem;
}
