/* ==================================================================
     GLASS WAVE NAV — START (copy everything from here to the END mark)
     Reverse-engineered from the "Wave" bar in code.xr's
     "Glassy Navigation Tabs V5" video
     (reference: https://codexrui.com/components/glassy-navigation-tabs-v5)
     Plain HTML/CSS/JS. No libraries.

     How the effect works, measured from the video:
     - The bar is a plain dark glass pill. Its shape never deforms.
     - A glowing mint line traces the bar's bottom edge, clipped to
       the pill boundary.
     - Where a tab is active, the line sweeps UP in a smooth bell loop
       around that tab's icon + label and comes back down, replacing
       the bottom line under the tab.
     - Icons and labels never move. Only the line travels.
     - The active tab also gets a small glowing dot between icon and
       label, and its label turns mint.
  ================================================================== */

  .wave-nav {
    /* CHANGE: --glow is the wave-line colour (mint green in the video).
       Swap in your brand colour here. */
    --glow: #7EDBC6;
    --glow-core: #FAF8F6;
    position: fixed;
    left: 50%;
    top: 20px;              /* distance from the bottom edge */
    transform: translateX(-50%);
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .45));
  }

  /* The frosted-glass pill. Simple rounded rect — the magic is the
     line drawn over it, not the shape. */
  .wave-nav .glass {
    position: absolute;
    inset: 0;
    border-radius: 23px;
    background: linear-gradient(180deg,
                rgba(43, 30, 91, .93) 0%,
                rgba(23, 20, 31, .92) 100%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  }

  /* The glowing wave line. Its path is computed by JS and clipped to
     the pill boundary, exactly like the source video. */
  .wave-nav svg.wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 23px;
    overflow: hidden;
    pointer-events: none;
  }
  .wave-nav svg.wave .halo-line {
    fill: none;
    stroke: var(--glow);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .32;
    filter: blur(2.2px);
  }
  .wave-nav svg.wave .core-line {
    fill: none;
    stroke: var(--glow-core);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 2.5px var(--glow))
            drop-shadow(0 0 7px rgba(126, 219, 198, .5));
  }

  /* Small glowing dot between the active icon and its label. */
  .wave-nav .dot {
    position: absolute;
    width: 4.5px;
    height: 4.5px;
    border-radius: 50%;
    background: var(--glow);
    box-shadow: 0 0 6px 2px rgba(126, 219, 198, .8);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
  }
  .wave-nav.has-active .dot { opacity: 1; }

  .wave-nav ul {
    position: relative;
    display: flex;
    list-style: none;
    height: 100%;
    margin: 0;
    padding: 0 12px;   /* side room so the bell fits inside the pill corner */
  }

  .wave-item {
    position: relative;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: none;
    border: 0;
    cursor: pointer;
    color: rgba(255, 255, 255, .7);
    font: inherit;
    text-decoration: none;
    padding: 6px 0 6.5px;
    transition: color .3s ease;
  }
  /* Invisible larger touch target around each tab. */
  .wave-item::before {
    content: '';
    position: absolute;
    inset: 0;
  }

  .wave-item .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    margin-bottom: 5px;   /* the glowing dot sits in this gap */
    color: inherit;
    transition: color .3s ease, filter .3s ease;
  }
  .wave-item .icon svg { width: 16px; height: 16px; }

  .wave-item .label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    line-height: 1;
  }

  /* Active tab: icon and label stay exactly where they are;
     they only get brighter. The wave line wraps around them. */
  .wave-item.active { color: #fff; }
  .wave-item.active .icon {
    color: #fff;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, .55));
  }
  .wave-item.active .label { color: var(--glow); }

  .wave-item:focus-visible { outline:2px solid var(--glow); outline-offset:-3px; border-radius:8px; }
  /* Two independently animated rows on narrow screens; no hidden tabs. */
  @media (max-width: 650px) {
    .wave-nav { top: max(10px, env(safe-area-inset-top)); width: min(100% - 20px, 430px); }
    .wave-nav ul { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-rows:repeat(2,46px); padding:0 8px; }
    .wave-nav .wave-item { width:100%; height:46px; }
    .wave-nav .glass { border-radius:18px; }
    .wave-nav svg.wave { border-radius:18px; }
    .wave-item .label { font-size:10px; }
  }

  /* Reduced motion: the line jumps instead of travelling. */
  @media (prefers-reduced-motion: reduce) {
    .wave-nav .dot { transition: none; }
    .wave-item, .wave-item .icon { transition: none; }
  }

  /* ================== GLASS WAVE NAV — END ========================== */

/* Keep the approved name and scroll hint in their existing header.
   At narrower widths the wave sits below those badges. */
.nav { pointer-events: none; }
.nav > .logo { pointer-events: auto; }
#waveNav { letter-spacing: normal; line-height: normal; }
@media (max-width: 1040px) {
  #waveNav { top: max(56px, calc(env(safe-area-inset-top) + 40px)); }
}
/* Keep direct hash links below the fixed navigation as well. */
@media (max-width: 650px) {
  :is(#instructional-design,#books,#films,#about,#journey,#method,#contact) {
    scroll-margin-top: calc(max(56px, env(safe-area-inset-top) + 40px) + 100px);
  }
}
@media (min-width: 651px) and (max-width: 1040px) {
  :is(#instructional-design,#books,#films,#about,#journey,#method,#contact) {
    scroll-margin-top: 110px;
  }
}
