/* Fixed title rail shared by every scrolling portfolio page. */

/* --mh-bottom-nav-h is defined in base.css, which every route loads. It used
   to live here, and the landing does not load this file — which is exactly how
   the rail ended up a different height on the landing than everywhere else. */

body:not(.landing-page) {
  padding-bottom: calc(var(--mh-bottom-nav-h) + env(safe-area-inset-bottom));
}

body .skip-link,
body .mh-skip {
  position: fixed;
  top: 0.75rem;
  left: var(--page-pad);
  z-index: 300;
  padding: 0.72rem 0.9rem;
  color: #071312;
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-stretch: 72%;
  font-variation-settings: "wdth" 72, "wght" 720;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateY(-180%);
}

body .skip-link:focus,
body .mh-skip:focus {
  transform: translateY(0);
}

.mh-chrome {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 220;
  min-height: var(--mh-bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: #080b0a url("../assets/brand/paper-grain.jpg") center / 512px auto;
  background-blend-mode: soft-light;
  border-top: 4px solid var(--mh-nav-accent);
}

/* The landing's rail carries its 4px rule INSIDE its own height (border-box).
   Here the border sits on the wrapper, so the wrapper must own the height and
   the rail simply fills it — otherwise the inner rail stands 4px taller than
   the landing's at every viewport. */
.mh-chrome {
  box-sizing: border-box;
  height: var(--mh-bottom-nav-h);
}

.mh-bottom-rail {
  position: relative;
  display: grid;
  grid-template-columns: 30.2% 38.4% 31.4%;
  height: 100%;
}

.mh-bottom-rail::before,
.mh-bottom-rail::after {
  position: absolute;
  top: -4px;
  bottom: 0;
  width: clamp(1.1rem, 2.15vw, 2.4rem);
  content: "";
  background: var(--mh-nav-accent);
  clip-path: polygon(38% 0, 100% 0, 61% 100%, 0 100%);
  pointer-events: none;
}

.mh-bottom-rail::before { left: 29.2%; }
.mh-bottom-rail::after { left: 67.7%; }

.mh-bottom-rail a {
  display: grid;
  place-items: center;
  min-width: 0;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: var(--mh-nav-size);
  font-stretch: var(--mh-nav-stretch);
  font-weight: var(--mh-nav-weight);
  font-variation-settings: "wdth" 66;
  line-height: 1;
  letter-spacing: var(--mh-nav-tracking);
  -webkit-text-stroke-width: 0;
  -webkit-text-stroke-color: currentColor;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    color 160ms linear,
    background-color 160ms linear,
    font-weight 220ms var(--mh-nav-ease),
    -webkit-text-stroke-width 220ms var(--mh-nav-ease);
}

.mh-bottom-rail a:first-child { text-indent: -1.2vw; }
.mh-bottom-rail a:nth-child(2) { text-indent: -2.2vw; }
.mh-bottom-rail a:last-child { text-indent: 0.6vw; }

.mh-bottom-rail a:hover,
.mh-bottom-rail a:focus-visible {
  color: #fff3e2;
  background: rgba(239, 92, 50, 0.12);
  font-weight: var(--mh-nav-hover-weight);
  -webkit-text-stroke-width: 0.012em;
}

.mh-bottom-rail a[aria-current="page"] {
  color: var(--mh-nav-accent);
  font-weight: var(--mh-nav-hover-weight);
}

.mh-bottom-rail a:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: -0.55rem;
}

body .noscript-nav {
  position: fixed;
  /* base.css anchors this bar to the top (`inset: 0 0 auto`). Re-anchoring it
     to the bottom without releasing `top` leaves both edges pinned, so the bar
     stretches the whole viewport and eats every click on the page — including
     the contact form's Send button, and only when JavaScript is off, which is
     exactly when nobody is looking. */
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 250;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: var(--mh-bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: #080b0a;
  border-top: 1px solid var(--coral);
}

body .noscript-nav a {
  display: grid;
  place-items: center;
  padding: 0.7rem 0.25rem;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 2.8vw, 0.88rem);
  font-stretch: 68%;
  font-variation-settings: "wdth" 68, "wght" 650;
  letter-spacing: 0.1em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.site-footer[hidden] { display: none !important; }

@media (max-width: 560px), (max-aspect-ratio: 4 / 5) {
  /* The landing tessellation uses a 10.4svh rail on portrait screens; keep
     inner routes on that same baseline so its lower cuts and copy clear the
     identical amount of space. */
  .mh-bottom-rail {
    grid-template-columns: repeat(3, 1fr);
  }

  .mh-bottom-rail::before { left: 31.8%; }
  .mh-bottom-rail::after { left: 65.1%; }

  .mh-bottom-rail a {
    font-size: var(--mh-nav-size);
    letter-spacing: var(--mh-nav-tracking);
    text-indent: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mh-bottom-rail a { transition: none; }
}

@media (forced-colors: active) {
  .mh-chrome,
  body .noscript-nav { border-top: 2px solid CanvasText; }
  .mh-bottom-rail::before,
  .mh-bottom-rail::after { background: CanvasText; }
}
