/* =============================================================
   Top bar as a rhythm track. Sections are onsets on a hairline, and the
   page you are on gets the bold one. The hairline fills as you scroll. Behind it, contour lines of a
   3-3-2 rhythm drift past; the pointer adds a bump of its own.
   ============================================================= */

:root {
  --cc-paper: 251, 250, 248;
  --cc-ink: 28, 28, 29;
  --cc-hot: #f0544c;
  --cc-nav-h: 84px;
}

@media (max-width: 767.98px) {
  :root {
    --cc-nav-h: 64px;
  }
}

body.fixed-top-nav {
  padding-top: var(--cc-nav-h) !important;
}

.cc-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  height: var(--cc-nav-h);
  background: rgb(var(--cc-ink));
  color: #fff;
  transition: height 0.25s ease;
}

.cc-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cc-nav-inner {
  position: static;
  display: flex;
  align-items: stretch;
  height: 100%;
}

.cc-brand {
  display: flex;
  align-items: center;
}

.cc-brand .navbar-logo-3d {
  transform-origin: left center;
  transition: transform 0.25s ease;
}

/* Home already shows the 3D logo, so the corner is a plain red triangle. */
.cc-mark {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cc-mark polygon {
  fill: #b31b1b;
  transform-origin: 50% 35px;
  transition: transform 0.3s ease;
}

.cc-brand:hover .cc-mark polygon {
  transform: rotate(-8deg);
}

.cc-nav-sheet {
  display: flex;
  align-items: stretch;
  margin-left: auto;
}

.cc-nav-list {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cc-nav-list li {
  display: flex;
}

.cc-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.86);
  transition: color 0.15s ease;
}

/* The section's onset on the track */
.cc-nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  transition: height 0.15s ease, background-color 0.15s ease;
}

.cc-nav-link:hover,
.cc-nav-link:focus-visible,
.cc-nav-link[aria-current] {
  color: var(--cc-hot);
}

.cc-nav-link:hover::after,
.cc-nav-link:focus-visible::after {
  height: 9px;
  background: rgba(255, 255, 255, 0.85);
}

.cc-nav-link[aria-current]::after,
.cc-nav-link.cc-here::after {
  width: 3px;
  height: 12px;
  margin-left: -1px;
  background: var(--cc-hot);
}

.cc-nav-list:has(.cc-here) .cc-nav-link[aria-current]:not(.cc-here) {
  color: rgba(255, 255, 255, 0.86);
}

.cc-nav-list:has(.cc-here) .cc-nav-link[aria-current]:not(.cc-here)::after {
  width: 1px;
  height: 6px;
  margin-left: 0;
  background: rgba(255, 255, 255, 0.4);
}

.cc-nav-link.cc-here {
  color: var(--cc-hot);
}

.cc-nav-link:focus-visible {
  outline: 2px solid var(--cc-hot);
  outline-offset: -6px;
  border-radius: 4px;
}

.cc-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.cc-track-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 1px;
  width: 100%;
  transform: scaleX(var(--cc-progress, 0));
  transform-origin: left;
  background: rgba(240, 84, 76, 0.75);
}


.cc-nav-toggle,
.cc-sheet-note {
  display: none;
}

.post-header .post-title {
  font-weight: 400;
  font-size: 2.9rem;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

@media (max-width: 576px) {
  .post-header .post-title {
    font-size: 2.3rem;
  }
}

@media (min-width: 768px) {
  /* Sections spread from the logo to the right edge */
  .cc-nav-sheet {
    flex: 1;
  }

  .cc-brand + .cc-nav-toggle + .cc-nav-sheet {
    margin-left: 2.5rem;
  }

  .cc-nav-list {
    flex: 1;
    justify-content: space-between;
  }

  .cc-nav-list li:first-child .cc-nav-link {
    padding-left: 0;
  }

  .cc-nav-list li:last-child .cc-nav-link {
    padding-right: 0;
  }

  /* Scrolled: a slimmer bar */
  .cc-nav.cc-compact {
    height: 62px;
  }

  .cc-nav.cc-compact .navbar-logo-3d {
    transform: scale(0.74);
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .cc-nav-link {
    padding: 0 0.55rem;
    font-size: 0.95rem;
  }
}

/* Phones: a full-height sheet with the same track, run vertically */
@media (max-width: 767.98px) {
  .cc-brand .navbar-logo-3d {
    width: 76px;
    height: 64px;
    margin: 0 0 0 -8px;
  }

  .cc-nav-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    width: 48px;
    margin: 0 -10px 0 auto;
    padding: 0 10px;
    border: 0;
    background: none;
    cursor: pointer;
  }

  /* Three bars at 3:3:2, the tresillo */
  .cc-nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 1px;
    background: #fff;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.2s ease, width 0.25s ease;
  }

  .cc-nav-toggle span:nth-child(3) {
    width: 16px;
  }

  .cc-open .cc-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .cc-open .cc-nav-toggle span:nth-child(2) {
    transform: rotate(-45deg);
  }

  .cc-open .cc-nav-toggle span:nth-child(3) {
    opacity: 0;
    width: 0;
  }

  .cc-nav-toggle:focus-visible {
    outline: 2px solid var(--cc-hot);
    outline-offset: 2px;
    border-radius: 4px;
  }

  .cc-nav-sheet {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100vh - var(--cc-nav-h));
    height: calc(100dvh - var(--cc-nav-h));
    display: none;
    margin: 0;
    padding: 1.6rem 1.5rem 2.5rem;
    overflow-y: auto;
    background: rgb(var(--cc-ink));
  }

  .cc-open .cc-nav-sheet {
    display: block;
  }

  .cc-open.cc-nav {
    z-index: 1100;
  }

  .cc-nav-list {
    position: relative;
    flex-direction: column;
    align-items: stretch;
  }

  .cc-nav-list::before {
    content: "";
    position: absolute;
    left: 0.75rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 1px;
    background: rgba(255, 255, 255, 0.18);
  }

  .cc-nav-list li {
    opacity: 0;
    transform: translateX(-6px);
  }

  .cc-open .cc-nav-list li {
    animation: cc-enter 0.32s ease-out forwards;
    animation-delay: var(--d, 0ms);
  }

  .cc-nav-link {
    width: 100%;
    padding: 0.5rem 0 0.5rem 2.4rem;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
  }

  .cc-nav-link::after {
    left: 0.75rem;
    top: 50%;
    bottom: auto;
    width: 10px;
    height: 1px;
  }

  .cc-nav-link:hover::after,
  .cc-nav-link:focus-visible::after {
    width: 14px;
    height: 1px;
  }

  .cc-nav-link[aria-current]::after,
  .cc-nav-link.cc-here::after {
    width: 18px;
    height: 3px;
    margin: -1px 0 0;
  }

  .cc-nav-list:has(.cc-here) .cc-nav-link[aria-current]:not(.cc-here)::after {
    width: 10px;
    height: 1px;
    margin: 0;
  }

  .cc-sheet-note {
    display: block;
    margin: 2.5rem 0 0 2.4rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
  }

  .cc-sheet-note a {
    color: rgba(255, 255, 255, 0.86);
  }

  body.cc-menu-open {
    overflow: hidden;
  }
}

@keyframes cc-enter {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-nav,
  .cc-brand .navbar-logo-3d {
    transition: none;
  }

  .cc-open .cc-nav-list li {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
