/* Shared, layout-neutral hit areas and keyboard-only focus states. */
.skip-link {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 10000;
  padding: 10px 12px;
  background: #111;
  color: #fff;
  font: 500 12px/1.2 "Eternal", Arial, sans-serif;
  letter-spacing: 0.01em;
  text-decoration: none;
  transform: translateY(calc(-100% - 24px));
  transition: transform 120ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

main:focus {
  outline: 0;
}

:where(.logo, .mobile-header > a, .mobile-header__logo, .mobile-menu__logo, .right-menu a) {
  position: relative;
}

:where(.logo, .mobile-header > a, .mobile-header__logo, .mobile-menu__logo, .right-menu a)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 16px);
  height: 44px;
  transform: translate(-50%, -50%);
}

:where(.project-intro__link, .project-intro__close, .pdf-preview-link, .pdf-preview-close, .work-contact-line a) {
  position: relative;
}

:where(.project-intro__link, .project-intro__close, .pdf-preview-link, .pdf-preview-close, .work-contact-line a)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 16px);
  height: 44px;
  transform: translate(-50%, -50%);
}

.pdf-preview-link::before,
.pdf-preview-close::before {
  width: calc(100% + 12px);
}

.section-nav__item {
  position: relative;
}

.section-nav__item::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 8px);
  height: 44px;
  transform: translate(-50%, calc(-50% + var(--section-hit-shift, 0px)));
}

.section-nav__item--hour {
  --section-hit-shift: -10px;
}

.section-nav__item--origin {
  --section-hit-shift: 10px;
}

:where(.work-image, .scroll-image, .work-video)[role="button"]:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

:where(
    .logo,
    .mobile-header > a,
    .mobile-header__logo,
    .mobile-menu__logo,
    .right-menu a,
    .menu-toggle,
    .mobile-menu__nav a,
    .mobile-menu__meta-value,
    .section-nav__item,
    .project-intro__link,
    .project-intro__close,
    .accordion-header,
    .copy-email,
    .contact-link,
    .mobile-floating-email,
    .mobile-floating-instagram
  ):focus-visible,
.lightbox-close:focus-visible,
.portfolio-viewer-close:focus-visible,
.pdf-preview-link:focus-visible,
.pdf-preview-close:focus-visible,
.portfolio-preview-button:focus-visible,
.contact-meta-row dd a:focus-visible,
.work-contact-line a:focus-visible {
  outline: 1px solid currentColor !important;
  outline-offset: 3px;
}

.menu-close:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.menu-close:focus-visible .menu-close__bar {
  opacity: 0.62;
}

.contact-meta-row dd a {
  position: relative;
}

.contact-meta-row dd a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 12px);
  height: 44px;
  transform: translate(-50%, -50%);
}

/* Keep secondary copy quiet while meeting normal-text contrast on white. */
main.info,
main.work,
main.contact {
  --muted: #707070;
}

body > footer .legal-footer {
  color: #707070 !important;
}

.after .korean-intro {
  color: #707070 !important;
  -webkit-text-fill-color: #707070 !important;
  text-shadow: none !important;
}

.right-menu a[aria-current="page"] {
  opacity: 0.62 !important;
}

/* Inactive project labels remain visibly subordinate, but not unreadable. */
.section-nav__item--origin,
.section-nav.is-origin .section-nav__item--hour {
  opacity: 0.56;
}

:where(.floating-contact, .mobile-floating-contact) :where(a, button),
.mobile-menu__meta-value {
  position: relative;
  display: inline-flex;
  min-height: 24px;
  align-items: center;
}

/* Korean index contact pair: reduce the visible row distance by 30% on
   tablet/desktop while the 24px pseudo-element hit areas remain unchanged. */
@media (min-width: 600px) {
  html[lang="ko"] .floating-contact :where(a, button) {
    min-height: 16.8px;
  }
}

:where(.floating-contact, .mobile-floating-contact) :where(a, button)::before,
.mobile-menu__meta-value::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 12px);
  height: 24px;
  transform: translate(-50%, calc(-50% + var(--compact-hit-shift, 0px)));
}

:where(.floating-contact, .mobile-floating-contact) :where(button, a:first-of-type),
.mobile-menu__meta-value:first-of-type {
  --compact-hit-shift: -6px;
}

:where(.floating-contact, .mobile-floating-contact) a:last-of-type,
.mobile-menu__meta-value:last-of-type {
  --compact-hit-shift: 6px;
}

@media (hover: none) {
  :where(
      .logo,
      .mobile-header > a,
      .mobile-header__logo,
      .mobile-menu__logo,
      .menu-toggle,
      .menu-close,
      .mobile-menu__nav a,
      .project-intro__link,
      .project-intro__close,
      .copy-email,
      .contact-link,
      .mobile-floating-email,
      .mobile-floating-instagram,
      .portfolio-preview-button,
      .pdf-preview-link,
      .pdf-preview-close,
      .contact-meta-row dd a,
      .work-contact-line a
    ):active {
    opacity: 0.55;
  }
}

@media (max-width: 767px) {
  .menu-toggle {
    width: 44px !important;
    height: 44px !important;
    margin: -6px !important;
  }

  .menu-toggle__bar {
    left: 12px !important;
    right: 12px !important;
  }

  .menu-toggle__bar:nth-child(1) {
    top: 18px !important;
  }

  .menu-toggle__bar:nth-child(2) {
    top: 22px !important;
  }

  .menu-toggle__bar:nth-child(3) {
    top: 26px !important;
  }

  .mobile-menu {
    min-height: 100dvh;
  }

  .section-nav__item--hour {
    --section-hit-shift: -1px;
  }

  .section-nav__item--origin {
    --section-hit-shift: 1px;
  }

  .lightbox-close {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
  }

  :where(.mobile-floating-contact, .mobile-menu__meta) {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
  }

  :where(.mobile-floating-contact, .mobile-menu__meta) > br {
    display: none;
  }

  /* Korean mobile contact pairs: tighten the visual rhythm by 25% while the
     separated pseudo-element hit areas continue to provide touch clearance. */
  html[lang="ko"] :where(.mobile-floating-contact, .mobile-menu__meta) .mobile-menu__meta-value,
  html[lang="ko"] .mobile-floating-contact :where(.mobile-floating-email, .mobile-floating-instagram) {
    min-height: 18px;
  }
}

/* Progressive language menu: the original anchor list remains usable until
   JavaScript enhances it into an overlay dropdown. */
.language-switcher.language-menu-ready {
  position: relative;
  display: inline-flex;
  z-index: 40;
  overflow: visible;
}

.language-menu-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.language-menu-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% + 16px);
  height: 44px;
  transform: translate(-50%, -50%);
}

.language-menu-button::after {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
  transform-origin: 50% 50%;
  transition: transform 160ms ease;
}

.language-menu-button[aria-expanded="true"]::after {
  transform: translateY(1px) rotate(225deg);
}

.language-menu-list {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: max-content;
  margin: 0;
  padding: 4px 0;
  background: var(--bg, #fff);
  color: var(--text, #111);
  border: 0;
  list-style: none;
  z-index: 100;
}

.language-menu-list[hidden] {
  display: none !important;
}

.language-menu-list li,
.language-menu-list a {
  display: block;
}

.language-menu-list:not([hidden]) li {
  opacity: 0;
  transform: translateY(-6px);
  animation: language-menu-item-reveal 220ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.language-menu-list:not([hidden]) li:nth-child(1) {
  animation-delay: 20ms;
}

.language-menu-list:not([hidden]) li:nth-child(2) {
  animation-delay: 55ms;
}

.language-menu-list:not([hidden]) li:nth-child(3) {
  animation-delay: 90ms;
}

.language-menu-list:not([hidden]) li:nth-child(4) {
  animation-delay: 125ms;
}

@keyframes language-menu-item-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.language-menu-list a {
  box-sizing: border-box;
  min-width: 132px;
  min-height: 44px;
  padding: 13px 14px 11px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.48;
}

.language-menu-list a[aria-current="page"] {
  text-decoration: none;
  opacity: 1;
}

.language-menu-list a:hover,
.language-menu-list a:focus-visible {
  opacity: 1;
}

.language-menu-list a:focus-visible,
.language-menu-button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

.language-switcher--mobile .language-menu-list {
  right: auto;
  left: 0;
  top: auto;
  bottom: calc(100% + 10px);
  background: #000;
  color: #fff;
}

@media (max-width: 767px) {
  .language-switcher--mobile.language-menu-ready {
    position: fixed;
    left: 20px;
    bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .language-menu-button {
    min-width: 44px;
    min-height: 44px;
    text-align: left;
  }

  .language-switcher--mobile .language-menu-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(106px, 1fr));
    width: 224px;
    padding: 4px 0;
    bottom: calc(100% + 8px);
  }

  .language-switcher--mobile .language-menu-list[hidden] {
    display: none !important;
  }

  .language-switcher--mobile .language-menu-list a {
    min-width: 0;
    width: 100%;
  }
}

/*
 * Keep lightbox controls in the overlay's own coordinate system. Nested
 * position:fixed elements can be resolved against the layout viewport by
 * iPad Safari after a long page scroll, which places the media above the
 * visible viewport. The overlay itself remains fixed; its children do not
 * need a second fixed positioning context.
 */
html.lightbox-open,
html.lightbox-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.lightbox .lightbox-close {
  position: absolute;
}

@media (max-width: 767px),
  (min-width: 768px) and (max-width: 1180px),
  (pointer: coarse) and (min-width: 768px) and (max-width: 1366px) {
  .lightbox .lightbox-media {
    position: absolute;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-delay: 0s !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }

  .language-menu-list:not([hidden]) li {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Keep subpage hero titles visually consistent from tablet upward. */
@media (min-width: 768px) {
  main.info h1,
  .work h1,
  main.contact h1 {
    font-size: clamp(16.9px, 2.6vw, 26px);
  }

  html[lang="ja"] main.info h1,
  html[lang="ja"] .work h1,
  html[lang="ja"] main.contact h1,
  html[lang="zh-CN"] main.info h1,
  html[lang="zh-CN"] .work h1,
  html[lang="zh-CN"] main.contact h1 {
    font-size: clamp(16px, 2.45vw, 24.5px);
  }
}

/* Match the two collaborate content gaps to the page's opening rhythm. */
.work {
  --collaborate-vertical-gap: calc(clamp(120px, 18vh, 190px) - 46.64px);
}

.work h1,
.work .portfolio-preview {
  margin-bottom: var(--collaborate-vertical-gap);
}

@media (max-width: 767px) {
  .work {
    --collaborate-vertical-gap: calc(clamp(144px, 24svh, 207px) - 39.77px);
  }

  .work .portfolio-preview-meta {
    justify-content: flex-start;
    gap: 12px;
  }

  .work .portfolio-preview-action {
    animation: portfolio-preview-highlight-twice 1.2s ease-in-out 0.72s both;
  }
}

@keyframes portfolio-preview-highlight-twice {
  0%, 18% {
    background-color: transparent;
  }
  32%, 44% {
    background-color: #dfff00;
  }
  58%, 70% {
    background-color: transparent;
  }
  84%, 100% {
    background-color: #dfff00;
  }
}

@media (prefers-reduced-motion: reduce) {
  .work .portfolio-preview-action {
    animation: none;
  }
}

/* Language-specific leading keeps project intro copy visually cohesive. */
html[lang="ko"] .project-intro__text {
  line-height: 1.82;
}

html[lang="en"] .project-intro__text {
  line-height: 1.76;
}

html[lang="ja"] .project-intro__text {
  line-height: 1.9;
}

html[lang="zh-CN"] .project-intro__text {
  line-height: 1.84;
}

html[lang="ko"] .project-intro__text + .project-intro__text,
html[lang="en"] .project-intro__text + .project-intro__text {
  margin-top: 12px;
}

html[lang="ja"] .project-intro__text + .project-intro__text,
html[lang="zh-CN"] .project-intro__text + .project-intro__text {
  margin-top: 10px;
}

@media (max-width: 767px) {
  html[lang="ko"] .project-intro__text + .project-intro__text,
  html[lang="en"] .project-intro__text + .project-intro__text {
    margin-top: 16px;
  }

  html[lang="ja"] .project-intro__text + .project-intro__text,
  html[lang="zh-CN"] .project-intro__text + .project-intro__text {
    margin-top: 14px;
  }
}
