:root {
  --global-dock-height: 5rem;
  --global-page-height: calc(100dvh - var(--global-dock-height));
  --global-page-bottom: var(--global-dock-height);
  --global-dock-gutter: 3rem;
  --global-dock-line: rgba(255, 255, 255, 0.32);
  --global-dock-progress: #f0f0f0;
  --global-dock-glass-mask: linear-gradient(to bottom, transparent 0%, #000 100%);
  --global-dock-control-font-size: 1.1rem;
  --global-dock-back-icon-size: 1.25rem;
}

/* Fixed dock safe area shared by every page. */
body.global-dock-ready {
  padding-bottom: var(--global-page-bottom);
  scroll-padding-bottom: var(--global-page-bottom);
}

.global-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30042;
  box-sizing: border-box;
  height: var(--global-dock-height);
  overflow: hidden;
  color: #f0f0f0;
  background: transparent;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  pointer-events: none;
  mix-blend-mode: difference;
  isolation: auto;
  contain: none;
}

.global-dock-surface {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30040;
  box-sizing: border-box;
  height: var(--global-dock-height);
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-mask-image: var(--global-dock-glass-mask);
  mask-image: var(--global-dock-glass-mask);
  pointer-events: none;
  isolation: auto;
  contain: none;
}

.global-dock-progress {
  position: fixed;
  top: auto;
  right: var(--global-dock-gutter);
  bottom: calc(var(--global-dock-height) - 1px);
  left: var(--global-dock-gutter);
  z-index: 30043;
  height: 1px;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
  mix-blend-mode: difference;
}

.global-dock-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--global-dock-line);
}

.global-dock-progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 0%;
  background: var(--global-dock-progress);
  transform-origin: left center;
  will-change: width;
}

body[data-global-dock-intro="pending"] .global-dock {
  opacity: 0;
  clip-path: inset(0 0 100% 0);
}

body[data-global-dock-intro="pending"] .global-dock-progress {
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
}

.global-dock__inner {
  position: absolute;
  inset: 0 var(--global-dock-gutter);
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto minmax(8rem, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 0;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: normal;
}

.global-dock__left,
.global-dock__center,
.global-dock__right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 44px;
  pointer-events: auto;
}

.global-dock__year {
  min-height: 44px;
  align-items: center;
}

.global-dock__left {
  justify-content: flex-start;
  min-width: 0;
}

.global-dock__center {
  justify-content: center;
  gap: 1.5rem;
}

.global-dock__detail-action {
  display: none;
}

.global-dock__right {
  justify-content: flex-end;
}

.global-dock__right .lang-current {
  width: max-content;
  flex: 0 0 auto;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
}

/* Shared bilingual text button. Each language has its own natural-width line;
 * the stage only reserves the wider of the two, so both states stay right-aligned
 * without stretching or spacing individual English characters. */
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: max-content;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.text-button__stage {
  position: relative;
  display: inline-grid;
  grid-template-areas: 'label';
  width: max-content;
  height: 1.2em;
  overflow: hidden;
}

.text-button__icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: var(--global-dock-back-icon-size);
  height: var(--global-dock-back-icon-size);
  margin-right: 0.38em;
  color: currentColor;
}

.text-button__icon svg {
  width: 100%;
  height: 100%;
}

.text-button__line {
  position: relative;
  grid-area: label;
  display: flex;
  justify-content: flex-end;
  justify-self: end;
  width: max-content;
  white-space: nowrap;
  overflow: hidden;
}

/* Both overlaid lines participate in grid sizing, so the stage always reserves
 * the wider bilingual label while keeping each state right-aligned. */

.text-button__char {
  display: block;
  flex: 0 0 auto;
  font-size: var(--global-dock-control-font-size);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  transition: transform 0.6s cubic-bezier(0.87, 0, 0.13, 1), color 0.3s ease;
  transition-delay: calc(var(--i) * 28ms);
}

.text-button__line--target .text-button__char {
  transform: translateY(100%);
}

.text-button:hover .text-button__line--current .text-button__char,
.text-button.is-text-button-committing .text-button__line--current .text-button__char {
  transform: translateY(-100%);
  color: #fff;
}

.text-button:hover .text-button__line--target .text-button__char,
.text-button.is-text-button-committing .text-button__line--target .text-button__char {
  transform: translateY(0);
  color: #fff;
}

.text-button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 0.25rem;
}

.global-dock__center a,
.global-dock__right a,
.global-dock__left a {
  color: inherit;
  text-decoration: none;
}

/* Keep phone controls comfortably tappable without changing their visible text. */
.global-dock__center a,
.global-dock__right [data-lang-toggle],
.global-dock__left .back-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.global-dock__sep {
  color: rgba(255, 255, 255, 0.28);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}

.global-dock .ch-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
}

.global-dock .ch-top,
.global-dock .ch-bot {
  display: block;
  font-size: var(--global-dock-control-font-size);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.8);
  transition: transform 0.6s cubic-bezier(0.87, 0, 0.13, 1), color 0.3s ease;
  transition-delay: calc(var(--i) * 28ms);
}

.global-dock .ch-bot {
  position: absolute;
  top: 100%;
  left: 0;
}

.global-dock .chr-hover:hover .ch-top,
.global-dock .chr-hover:hover .ch-bot {
  transform: translateY(-100%);
  color: #fff;
}

.global-dock__year {
  display: inline-flex;
}

.global-dock__back-slot {
  display: none;
  align-items: center;
}

.global-dock[data-mode="back"] .global-dock__year {
  display: none;
}

.global-dock[data-mode="back"] .global-dock__back-slot {
  display: flex;
}

/* Keep the center slot available for future contextual controls. Only the
 * current primary links are home-only. */
.global-dock[data-mode="back"] [data-global-dock-home-only] {
  display: none;
}

.global-dock[data-mode="back"][data-detail-action="true"] .global-dock__detail-action {
  display: inline-flex;
}

.global-dock .back-btn,
.global-dock .detail-back {
  position: static;
  inset: auto;
  z-index: auto;
  display: inline-flex;
  margin: 0;
  color: #f0f0f0;
  text-decoration: none;
  mix-blend-mode: normal;
  filter: none;
}

body.global-dock-ready .global-dock .back-btn {
  opacity: 1 !important;
}

.global-dock .detail-back {
  cursor: pointer;
}

body.global-dock-ready #hero-bar,
body.global-dock-ready #hero-line,
body.global-dock-ready .scroll-timeline,
body.global-dock-ready .detail-thumbs.side-progress {
  display: none !important;
}

body.global-dock-ready .info-bottom {
  display: none !important;
}

body.global-dock-ready:not(.works-page) .ruler,
body.global-dock-ready:not(.works-page) .counter-wrap {
  display: none !important;
}

@media (max-width: 768px) {
  :root {
    --global-dock-gutter: 1.5rem;
  }

  .global-dock__inner {
    grid-template-columns: minmax(4.5rem, 1fr) auto minmax(3rem, 1fr);
    gap: 0.75rem;
  }

  .global-dock__center {
    gap: 0.6rem;
  }

}
