/* ==========================================================================
   Sticky in-page anchor row
   Figma: 18357:9208 (About, 9 items) / 18380:9376 (Facilities, 6 items)

   Row 80px tall, 16px vertical padding, items 142.667px wide (214px on
   Facilities, which has fewer of them — the row simply distributes what it has).
   Active item is Noto Sans JP Bold with an 88x3px rounded indicator, both in
   the heading navy. Desktop sticks below the 90px header; mobile below 64px.
   ========================================================================== */

.page-nav {
  --page-nav-h: 80px;
  --page-nav-border: #d7ebf0; /* Figma raw hex; no token for this tint */

  position: sticky;
  top: 90px;
  z-index: 20;
  background: var(--c-white);
  border-top: 1px solid var(--page-nav-border);
  border-bottom: 1px solid var(--page-nav-border);
}

.page-nav__list {
  display: flex;
  align-items: stretch;
  width: min(100%, var(--page-w, 1440px));
  height: var(--page-nav-h);
  margin: 0 auto;
  padding: 0 var(--page-gutter, 78px);
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.page-nav__list::-webkit-scrollbar {
  display: none;
}

.page-nav__item {
  display: flex;
  flex: 0 0 auto;
}

.page-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fixed width so switching the active item to Bold cannot reflow the row. */
  width: 142.667px;
  min-height: 44px;
  color: var(--c-teal-800);
  font-family: var(--ff-jp);
  font-size: var(--fs-16);
  font-weight: 400;
  line-height: 48px;
  text-align: center;
  text-decoration: none;
  transition: color 200ms ease;
}

.page-nav__link:hover {
  color: var(--c-teal-900);
}

.page-nav__link:focus-visible {
  outline: 2px solid var(--c-teal-900);
  outline-offset: -4px;
}

/* Active-section indicator: Figma 88x3px, radius 2px, 12px above the row's
   bottom edge (top 65px of 80px). The underline itself stays static — only
   which link carries it changes. */
.page-nav__link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 88px;
  height: 3px;
  border-radius: 2px;
  background: var(--c-teal-800);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 200ms ease;
}

.page-nav__link.is-current {
  font-weight: 700;
}
.page-nav__link.is-current::after {
  transform: translateX(-50%) scaleX(1);
}

/* Anchor targets clear the sticky header (90) + row (80) + 24 breathing room,
   i.e. the handoff's 194px total.

   main.css:188 sets html { scroll-padding-top: 104px } site-wide and the
   browser adds that to scroll-margin-top. Worse, measured in Chrome, padding
   does not resolve linearly at narrow widths — 104px lands a section 143px
   down at 375px, and 136px lands it 278px down — while scroll-margin-top is
   exact at every width. So this file zeroes the padding and carries the whole
   offset in the margin: one number, the handoff's number, in one place.

   Neutralising a site-wide rule is safe here because page-nav.css is only
   enqueued by page-about.php and page-facilities.php; no other page loads it. */
html {
  scroll-padding-top: 0;
}

/* Scoped to sections so it cannot affect focused inputs or the nav itself. */
.page-about section[id],
.page-facilities section[id] {
  scroll-margin-top: 194px;
}

@media (max-width: 64rem) {
  .page-nav__link {
    width: auto;
    min-width: 0;
    padding: 0 20px;
  }
}

@media (max-width: 48rem) {
  .page-nav {
    --page-nav-h: 56px;
    top: 64px;
  }
  .page-nav__list {
    padding: 0 20px;
  }
  .page-nav__link {
    padding: 0 14px;
    font-size: var(--fs-14);
    line-height: 1.4;
  }
  .page-nav__link::after {
    bottom: 6px;
    width: calc(100% - 28px);
  }
  /* 136px total on mobile: header 64 + row 56 + 16 breathing room. */
  .page-about section[id],
  .page-facilities section[id] {
    scroll-margin-top: 136px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-nav__link,
  .page-nav__link::after {
    transition: none;
  }
}
