/* ------------------------------------------------------------------
   Section Dock — "Wayfinder"
   Home-page sticky section navigation. Appears once the visitor scrolls
   past the hero; scrollspies the page and offers one-tap travel to any
   section. Desktop (≥1200px): full glass rail with sliding ink pill.
   Below 1200px: compact pill that expands into a stacked sheet.
   Markup lives in index.html, behaviour in js/section-dock.js.
------------------------------------------------------------------ */

@property --wf-spin {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.ie-wf {
  --wf-glass: rgba(var(--base-rgb), 0.9);
  --wf-hairline: rgba(255, 255, 255, 0.14);
  --wf-ink: rgba(var(--accent-rgb), 0.16);
  --wf-shadow:
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 4px 14px rgba(0, 0, 0, 0.35);
  --wf-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --wf-ease-spring: cubic-bezier(0.34, 1.4, 0.44, 1);
  position: fixed;
  left: 50%;
  bottom: calc(2.2rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  transform: translate(-50%, 140%) scale(0.94);
  opacity: 0;
  pointer-events: none;
  /* no filter in this transition — animated blur over backdrop-filter
     flickers in Chromium while the page scrolls */
  transition:
    transform 0.65s var(--wf-ease-out),
    opacity 0.45s ease;
  will-change: transform, opacity;
}

.ie-wf[data-state="shown"] {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* stay out of the way while the fullscreen menu owns the screen */
body.ie-menu-locked .ie-wf {
  transform: translate(-50%, 140%) scale(0.94);
  opacity: 0;
  pointer-events: none;
}

[color-scheme=light] .ie-wf {
  --wf-glass: rgba(255, 255, 255, 0.9);
  --wf-hairline: rgba(22, 22, 22, 0.12);
  --wf-ink: rgba(var(--accent-rgb), 0.2);
  --wf-shadow:
    0 24px 48px -14px rgba(22, 22, 22, 0.22),
    0 4px 14px rgba(22, 22, 22, 0.1);
}

/* ------------------------------------------------------------------
   Shared glass shell (dock + pill + sheet)
------------------------------------------------------------------ */

.ie-wf__dock,
.ie-wf__pill,
.ie-wf__sheet {
  position: relative;
  background: var(--wf-glass);
  /* heavy blur turns whatever scrolls behind into an unreadable frosted wash;
     the near-opaque tint above is the belt-and-braces so no text reads through
     even where backdrop-filter is unsupported */
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  backdrop-filter: blur(30px) saturate(1.6);
  box-shadow:
    var(--wf-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border: 1px solid var(--wf-hairline);
  overflow: hidden;
}

/* slow travelling glint around the border */
.ie-wf__sheen {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--wf-spin),
    transparent 0deg,
    rgba(var(--accent-rgb), 0.65) 42deg,
    transparent 82deg,
    transparent 176deg,
    rgba(255, 255, 255, 0.28) 220deg,
    transparent 264deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: wf-spin 9s linear infinite;
  pointer-events: none;
}

[color-scheme=light] .ie-wf__sheen {
  background: conic-gradient(
    from var(--wf-spin),
    transparent 0deg,
    rgba(var(--accent-rgb), 0.85) 42deg,
    transparent 82deg,
    transparent 176deg,
    rgba(22, 22, 22, 0.2) 220deg,
    transparent 264deg
  );
}

@keyframes wf-spin {
  to { --wf-spin: 360deg; }
}

/* film grain, keeps the glass from feeling flat */
.ie-wf__grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  opacity: 0.05;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ------------------------------------------------------------------
   Desktop rail
------------------------------------------------------------------ */

.ie-wf__dock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 5.6rem;
  padding: 0 1.6rem 0 0.7rem;
  border-radius: 999px;
}

/* left cap — progress ring wrapping the live section index */
.ie-wf__meter {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.2rem;
  height: 4.2rem;
  flex: none;
}

.ie-wf__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ie-wf__ring-track {
  fill: none;
  stroke: var(--wf-hairline);
  stroke-width: 2;
}

.ie-wf__ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 106.8;
  stroke-dashoffset: 106.8;
  filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), 0.55));
}

.ie-wf__idx {
  position: relative;
  overflow: hidden;
  font: var(--fw-medium) 1.3rem/1 var(--_font-accent);
  letter-spacing: 0.04em;
  color: var(--t-bright);
  font-variant-numeric: tabular-nums;
}

.ie-wf__idx > span {
  display: block;
}

.ie-wf__idx.is-tick > span {
  animation: wf-tick 0.55s var(--wf-ease-out);
}

@keyframes wf-tick {
  0%   { transform: translateY(110%); opacity: 0; filter: blur(2px); }
  100% { transform: translateY(0);    opacity: 1; filter: blur(0); }
}

/* hairline dividers between the caps and the rail */
.ie-wf__sep {
  width: 1px;
  height: 2.2rem;
  flex: none;
  background: linear-gradient(to bottom, transparent, var(--wf-hairline) 30%, var(--wf-hairline) 70%, transparent);
}

/* links rail */
.ie-wf__rail {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.3rem;
}

/* sliding ink highlight behind the active link */
.ie-wf__inkbar {
  position: absolute;
  top: 50%;
  left: 0;
  height: 3.4rem;
  width: 0;
  border-radius: 999px;
  background: var(--wf-ink);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.28),
    0 0 18px -2px rgba(var(--accent-rgb), 0.3);
  transform: translateY(-50%);
  opacity: 0;
  transition:
    left 0.55s var(--wf-ease-spring),
    width 0.55s var(--wf-ease-spring),
    opacity 0.3s ease;
  pointer-events: none;
}

.ie-wf__inkbar.is-on {
  opacity: 1;
  animation: wf-ink-breathe 3.4s ease-in-out infinite;
}

/* the active highlight softly breathes so the dock never feels frozen */
@keyframes wf-ink-breathe {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(var(--accent-rgb), 0.26),
      0 0 16px -3px rgba(var(--accent-rgb), 0.28);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(var(--accent-rgb), 0.42),
      0 0 26px 0 rgba(var(--accent-rgb), 0.46);
  }
}

.ie-wf__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 3.4rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font: var(--fw-medium) 1.3rem/1 var(--_font-default);
  letter-spacing: 0.01em;
  color: var(--t-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.35s ease;
}

/* Per-item index numbers removed from the nav (desktop rail + mobile
   sheet) — the labels read cleaner on their own. The ring's live index
   remains as the single progress readout. */
.ie-wf__num {
  display: none;
  font: var(--fw-regular) 0.95rem/1 var(--_font-accent);
  letter-spacing: 0.08em;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
  transform: translateY(-0.35em);
  transition: color 0.35s ease;
}

/* live pulsing dot — only breathes inside the active link */
.ie-wf__live {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  margin-right: -0.1rem;
  display: none;
}

.ie-wf__live::before,
.ie-wf__live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
}

.ie-wf__live::before {
  animation: wf-ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.ie-wf__live::after {
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
  animation: wf-breathe 2.4s ease-in-out infinite;
}

@keyframes wf-ping {
  0%       { transform: scale(1);   opacity: 0.8; }
  75%, 100% { transform: scale(2.8); opacity: 0; }
}

@keyframes wf-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.78); }
}

/* label — accent "ink" floods the letters left→right on hover.
   A two-stop gradient (accent | current text colour) sized to 200% and
   clipped to the glyphs; sliding its position sweeps the fill across. */
.ie-wf__text {
  position: relative;
  display: block;
}

.ie-wf__roll {
  display: block;
  color: var(--t-medium);
  background-image: linear-gradient(90deg, var(--accent) 0 50%, currentColor 50% 100%);
  background-size: 200% 100%;
  background-position: 100% 0; /* idle: shows the current-colour half */
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-position 0.55s var(--wf-ease-out);
}

.no-touch .ie-wf__link:hover .ie-wf__roll {
  background-position: 0 0; /* accent has flooded the whole label */
}

/* active label rides the theme's bright ink (the fill still overrides on hover) */
.ie-wf__link.is-active .ie-wf__roll {
  color: var(--t-bright);
}

.no-touch .ie-wf__link:hover,
.ie-wf__link.is-active {
  color: var(--t-bright);
}

.no-touch .ie-wf__link:hover .ie-wf__num,
.ie-wf__link.is-active .ie-wf__num {
  color: var(--accent);
}

.ie-wf__link.is-active .ie-wf__live {
  display: block;
}

.ie-wf__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* right cap — scroll depth as a slim "elevator" gauge: a luminous accent
   bead rises through a finely-ticked instrument track as the page advances.
   Reads as craft, not a throwaway percentage. */
.ie-wf__gauge {
  position: relative;
  flex: none;
  width: 0.5rem;
  height: 3.2rem;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0 0.34rem,
      rgba(var(--accent-rgb), 0.16) 0.34rem 0.4rem
    ),
    var(--wf-hairline);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.ie-wf__gauge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  min-height: 0.5rem; /* a bead is always present, even at the very top */
  border-radius: 999px;
  background: linear-gradient(to top, rgba(var(--accent-rgb), 0.5), var(--accent));
  box-shadow: 0 0 12px -1px rgba(var(--accent-rgb), 0.75);
  transition: height 0.18s linear;
}

/* ------------------------------------------------------------------
   Compact pill + sheet (below 1200px)
------------------------------------------------------------------ */

.ie-wf__pill {
  display: none;
  align-items: center;
  gap: 1rem;
  height: 4.8rem;
  padding: 0 0.8rem 0 1.7rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--t-bright);
  -webkit-tap-highlight-color: transparent;
}

.ie-wf__pill .ie-wf__live {
  display: block;
}

.ie-wf__pill-label {
  position: relative;
  overflow: hidden;
  font: var(--fw-medium) 1.4rem/1 var(--_font-default);
  letter-spacing: 0.01em;
  color: var(--t-bright);
  max-width: 40vw;
  white-space: nowrap;
}

.ie-wf__pill-label > span {
  display: block;
}

.ie-wf__pill-label.is-tick > span {
  animation: wf-tick 0.55s var(--wf-ease-out);
}

.ie-wf__pill-count {
  font: var(--fw-regular) 1.1rem/1 var(--_font-accent);
  letter-spacing: 0.06em;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
}

.ie-wf__pill-meter {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  flex: none;
}

.ie-wf__pill-meter .ie-wf__caret {
  font-size: 1.4rem;
  color: var(--t-medium);
  transition: transform 0.45s var(--wf-ease-spring), color 0.3s ease;
}

.ie-wf[data-open="true"] .ie-wf__caret {
  transform: rotate(180deg);
  color: var(--accent);
}

/* tap-catcher behind the open sheet */
.ie-wf__scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.ie-wf[data-open="true"] .ie-wf__scrim {
  opacity: 1;
  pointer-events: auto;
}

.ie-wf__sheet {
  position: absolute;
  bottom: calc(100% + 1rem);
  left: 50%;
  transform: translate(-50%, 1.4rem) scale(0.96);
  transform-origin: 50% 100%;
  min-width: 25rem;
  padding: 1rem 0.8rem;
  border-radius: 2.4rem;
  /* the sheet sits over busy content — near-opaque so items stay legible */
  background: rgba(var(--base-rgb), 0.96);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  backdrop-filter: blur(26px) saturate(1.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.5s var(--wf-ease-spring),
    opacity 0.35s ease,
    visibility 0s linear 0.35s;
}

.ie-wf[data-open="true"] .ie-wf__sheet {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    transform 0.5s var(--wf-ease-spring),
    opacity 0.35s ease,
    visibility 0s;
}

.ie-wf__sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1.2rem 0.9rem;
  font: var(--fw-regular) 1.05rem/1 var(--_font-accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-muted);
}

.ie-wf__sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ie-wf__sheet-item {
  opacity: 0;
  transform: translateY(1rem);
  transition:
    opacity 0.4s ease,
    transform 0.5s var(--wf-ease-out);
}

.ie-wf[data-open="true"] .ie-wf__sheet-item {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(0.05s + var(--i) * 0.038s);
}

.ie-wf__sheet-link {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.05rem 1.2rem;
  border-radius: 1.4rem;
  font: var(--fw-medium) 1.45rem/1 var(--_font-default);
  color: var(--t-medium);
  text-decoration: none;
  transition: color 0.3s ease, background-color 0.3s ease;
}

.ie-wf__sheet-link .ie-wf__num {
  transform: none;
  font-size: 1.05rem;
  min-width: 1.8rem;
}

.ie-wf__sheet-link .ie-wf__live {
  margin-left: auto;
}

.ie-wf__sheet-link.is-active {
  color: var(--t-bright);
  background: var(--wf-ink);
}

.ie-wf__sheet-link.is-active .ie-wf__live {
  display: block;
}

.ie-wf__sheet-link.is-active .ie-wf__num {
  color: var(--accent);
}

.ie-wf__sheet-link:active {
  background: var(--wf-ink);
}

/* ------------------------------------------------------------------
   Breakpoints
------------------------------------------------------------------ */

@media only screen and (max-width: 1199px) {
  /* Bottom-left anchored so the floating pill never collides with the
     to-top button parked in the bottom-right corner. */
  .ie-wf {
    left: max(1.4rem, env(safe-area-inset-left, 0px));
    right: auto;
    bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
    transform: translate(0, 165%) scale(0.96);
  }

  .ie-wf[data-state="shown"] {
    transform: translate(0, 0) scale(1);
  }

  body.ie-menu-locked .ie-wf {
    transform: translate(0, 165%) scale(0.96);
  }

  .ie-wf__dock {
    display: none;
  }

  .ie-wf__pill {
    display: flex;
    /* near-solid so the control stays legible over bright video/imagery
       instead of dissolving into it */
    background: rgba(var(--base-rgb), 0.92);
    -webkit-backdrop-filter: blur(30px) saturate(1.6);
    backdrop-filter: blur(30px) saturate(1.6);
  }

  /* Sheet unfurls upward from the pill's left edge. */
  .ie-wf__sheet {
    left: 0;
    transform-origin: 0 100%;
    transform: translate(0, 1.4rem) scale(0.96);
    min-width: min(30rem, calc(100vw - 2.8rem));
    max-width: calc(100vw - 2.8rem);
  }

  .ie-wf[data-open="true"] .ie-wf__sheet {
    transform: translate(0, 0) scale(1);
  }
}

@media only screen and (max-width: 420px) {
  /* Let the pill breathe across the small viewport without touching the
     to-top button — pin both bottom corners to a shared baseline. */
  .ie-wf__pill-label {
    max-width: 44vw;
  }
}

@media only screen and (min-width: 1200px) {
  .ie-wf__pill,
  .ie-wf__sheet,
  .ie-wf__scrim {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Reduced motion — keep it functional, drop the theatre
------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .ie-wf,
  .ie-wf__inkbar,
  .ie-wf__sheet,
  .ie-wf__sheet-item,
  .ie-wf__roll,
  .ie-wf__caret {
    transition-duration: 0.01s !important;
  }

  .ie-wf__sheen,
  .ie-wf__live::before,
  .ie-wf__live::after,
  .ie-wf__inkbar.is-on {
    animation: none !important;
  }

  .ie-wf__live::before {
    opacity: 0;
  }

  .ie-wf__idx.is-tick > span,
  .ie-wf__pill-label.is-tick > span {
    animation: none;
  }
}
