/* Shared nav brand lockup, language switcher, footer, mobile chrome — index / work / about */

/* Brand lockup (nav text + footer) */
.brand-lockup {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.brand-lockup__row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.65rem;
}
.brand-lockup strong {
  font-size: 1rem;
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.brand-lockup__zh {
  font-size: 0.8rem;
  color: var(--subtle);
  letter-spacing: 0.12em;
  line-height: 1.15;
}
.brand-lockup__tag {
  font-size: 0.68rem;
  line-height: 1.25;
  letter-spacing: 0.06em;
  color: var(--accent3);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: auto;
  text-decoration: none;
  color: var(--fg);
}
.nav__brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

/* Language */
.lang {
  position: relative;
}
.lang__current {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.lang__code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1;
  user-select: none;
  pointer-events: none;
  margin-right: -8px;
}
.lang__toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.lang__toggle:hover,
.lang__toggle[aria-expanded="true"] {
  color: var(--accent);
}
.lang__current:has(.lang__toggle:hover) .lang__code,
.lang__current:has(.lang__toggle[aria-expanded="true"]) .lang__code {
  color: var(--accent);
}
.lang__toggle svg {
  width: 25px;
  height: 25px;
  display: block;
}
.lang__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 5.5rem;
  padding: 2px;
  gap: 2px;
  background: var(--background1);
  border: 1px solid rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 120;
}
.lang__menu[hidden] { display: none; }
.lang__option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang__option:hover {
  color: var(--fg);
  background: var(--hover2);
}
.lang__option.is-active {
  color: var(--accent);
}

.nav__cta svg {
  width: 26px;
  height: 26px;
  display: block;
  transform: translateY(-2px);
}

/* Prevent double-tap zoom on controls */
a, button, input, select, textarea, label {
  touch-action: manipulation;
}

/* Contact divider (phone/tablet) + jump anchor (desktop → section top) */
.contact-divider {
  display: none;
}
#contact {
  position: relative;
  scroll-margin-top: calc(var(--nav-h) + 0.35rem);
}
.contact-jump {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  scroll-margin-top: calc(var(--nav-h) + 0.35rem);
}

/* Narrow screens: fixed page-scroll shell + hamburger chrome */
@media (max-width: 959.98px) {
  html {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100svh;
    max-height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
  }

  .nav {
    position: relative;
    top: auto;
    flex: 0 0 auto;
    z-index: 200;
  }

  .page-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .hero,
  .caps-panel,
  .studio,
  .journey-panel {
    min-height: calc(100svh - var(--nav-h));
  }

  .nav__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0;
  }

  .nav__toggle {
    grid-column: 1;
    justify-self: start;
    margin-left: 0;
    width: 24px;
    height: 24px;
    padding: 3px;
    gap: 3.5px;
  }

  .nav__toggle span {
    height: 1.25px;
  }

  .nav__brand {
    grid-column: 2;
    justify-self: center;
    margin-right: 0;
  }

  .nav__actions {
    grid-column: 3;
    justify-self: end;
    gap: 0;
  }

  .nav__cta {
    display: inline-flex;
    width: 36px;
    height: 36px;
  }

  .nav__cta svg {
    width: 22px;
    height: 22px;
    transform: translateY(-1px);
  }

  .lang__code {
    font-size: 10px;
    margin-right: -6px;
  }

  .lang__toggle {
    width: 38px;
    height: 38px;
  }

  .lang__toggle svg {
    width: 22px;
    height: 22px;
  }

  .nav.is-open .nav__toggle {
    position: relative;
    z-index: 230;
  }

  .nav__mobile {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: block;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .nav__mobile.is-open,
  .nav__mobile.is-closing {
    visibility: visible;
  }

  .nav__mobile.is-open {
    pointer-events: auto;
  }

  .nav__mobile[hidden] {
    display: none !important;
  }

  .nav__mobile-topmask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: transparent;
    z-index: 1;
    touch-action: none;
  }

  .nav__mobile-backdrop {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 240ms ease;
    touch-action: none;
  }

  .nav__mobile.is-open .nav__mobile-backdrop {
    opacity: 1;
  }

  .nav__mobile.is-closing .nav__mobile-backdrop {
    opacity: 0;
  }

  .nav__mobile-panel {
    --nav-sheet-ease: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
    position: absolute;
    top: calc(var(--nav-h) + 10px);
    left: 0;
    z-index: 2;
    width: min(50vw, 180px);
    max-height: min(72vh, 560px);
    display: flex;
    flex-direction: column;
    padding: 20px 14px 25px 12px;
    border-radius: 0 18px 18px 0;
    background: linear-gradient(
      135deg,
      rgba(75, 75, 75, 0.4) 0%,
      rgba(0, 0, 0, 0.4) 20%,
      rgba(0, 0, 0, 0.4) 100%
    );
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    transform: translate3d(-110%, 0, 0);
    transition: var(--nav-sheet-ease);
    overscroll-behavior: contain;
    touch-action: pan-y;
    transform-origin: top left;
  }

  .nav__mobile.is-open .nav__mobile-panel {
    transform: translate3d(0, 0, 0);
  }

  .nav__mobile.is-closing .nav__mobile-panel {
    transform: translate3d(-110%, 0, 0);
  }

  .nav__mobile-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .nav__mobile-body > a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--muted);
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease;
  }

  .nav__mobile-body > a:hover,
  .nav__mobile-body > a:focus-visible {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.04);
  }

  .nav__mobile-body > a.is-active {
    color: var(--accent);
  }

  .nav__mobile-handle {
    position: absolute;
    top: 50%;
    right: 4px;
    width: 3px;
    height: 52px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    touch-action: none;
    cursor: grab;
    transform: translateY(-50%);
  }

  .nav__mobile-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 96px;
  }

  .nav__mobile-handle:active,
  .nav__mobile-handle.is-press {
    background: rgba(242, 242, 239, 0.55);
  }

  .contact-details__qr {
    margin-top: 20px;
  }

  .contact-divider {
    display: block;
    width: 90%;
    height: 1px;
    margin: 10px auto 20px;
    border: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(242, 242, 239, 0.28) 18%,
      rgba(242, 242, 239, 0.28) 82%,
      transparent 100%
    );
  }

  .contact-jump {
    position: static;
    width: auto;
    margin-top: -20px;
    scroll-margin-top: calc((var(--nav-h) * -1) + 20px);
  }
}

/* Tablet portrait + phone landscape: copy | contact-details */
@media (min-width: 768px) and (max-width: 959.98px) and (orientation: portrait),
  (max-width: 959.98px) and (orientation: landscape) and (max-height: 500px) {
  .contact {
    grid-template-columns: 1fr;
  }
  .contact__intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.5rem;
    align-items: start;
  }
  .contact__intro > .eyebrow,
  .contact__intro > h2,
  .contact__intro > .lead {
    grid-column: 1;
  }
  .contact__intro > .contact-details {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: start;
    margin-top: 0;
    margin-left: 0;
    max-width: none;
    width: 100%;
  }
}

/* Phone only — compact nav + single-language brand */
@media (max-width: 767.98px) {
  html {
    --nav-h: 48px;
  }

  .nav {
    height: auto;
    min-height: 0;
    padding: 10px;
    box-sizing: border-box;
  }

  .nav .wrap {
    width: 100%;
  }

  .nav__inner {
    height: auto;
    min-height: 0;
  }

  .nav__brand {
    gap: 0.4rem;
    align-items: center;
  }

  .nav__brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }

  .nav__brand .brand-lockup {
    justify-content: center;
    align-items: center;
  }

  .nav__brand .brand-lockup__tag {
    display: none;
  }

  .nav__brand .brand-lockup__row {
    align-items: center;
  }

  html[lang="en"] .nav__brand .brand-lockup__zh {
    display: none;
  }
  html[lang="zh-Hans"] .nav__brand .brand-lockup strong {
    display: none;
  }
  html[lang="zh-Hans"] .nav__brand .brand-lockup__zh {
    color: var(--fg);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
  }
  .nav__brand .brand-lockup strong {
    font-size: 0.9rem;
    line-height: 1;
  }
}

/* Phone + tablet portrait: hero copy down */
@media (max-width: 767.98px), (max-width: 959.98px) and (orientation: portrait) {
  .hero .hero__inner {
    transform: translateY(100px);
  }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.1rem 0;
  background: #070809;
}
.footer__inner {
  position: relative;
  display: grid;
  gap: 0.65rem;
  align-items: center;
}
.footer__brand {
  text-decoration: none;
  color: inherit;
}
.footer__brand:hover { color: inherit; }
.copy {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--subtle);
  margin: 0;
  text-align: center;
}
@media (min-width: 800px) {
  .footer__inner {
    grid-template-columns: auto 1fr;
    gap: 2rem;
  }
  .copy {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 12rem);
  }
}
