:root {
  --transition-duration: 500ms;
  --display-size: 26px;
  --display-leading: 36px;
  --page-gutter: 20px;
  --compact-size: 14px;
  --compact-leading: 19px;
  --section-grid-gap: 20px;
  --section-cell-height: 72px;
  --section-rule: 2px;
  --paper: #ffffff;
  --ink: #000000;
  --muted-ink: rgba(0, 0, 0, 0.4);
  --link: #0000ee;
  color-scheme: light dark;
}

html[data-theme="dark"],
[data-theme="dark"] {
  --paper: #121212;
  --ink: #f0f0f0;
  --muted-ink: rgba(240, 240, 240, 0.6);
  --link: #6ea8fe;
}

html[data-theme="dark"] .image-popup.is-visible::backdrop,
[data-theme="dark"] .image-popup.is-visible::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

html[data-theme="light"],
[data-theme="light"] {
  --paper: #ffffff;
  --ink: #000000;
  --muted-ink: rgba(0, 0, 0, 0.4);
  --link: #0000ee;
}

html[data-theme="light"] .image-popup.is-visible::backdrop,
[data-theme="light"] .image-popup.is-visible::backdrop {
  background: rgba(0, 0, 0, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
}

html {
  scroll-behavior: smooth;
}

body,
button {
  font-family: Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

::selection {
  color: var(--paper);
  background: var(--ink);
}

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: color var(--transition-duration) ease;
}

a:hover {
  color: #78bce8;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.global-header {
  display: flex;
  flex: none;
  align-items: center;
  min-height: 0;
  padding: var(--page-gutter);
  background: var(--paper);
}

.global-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 20px;
  line-height: 25px;
}

.global-nav a {
  color: var(--ink);
  text-decoration: none;
}

.global-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

.header-lang-switch {
  margin-left: auto;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  color: var(--ink);
  opacity: 0.6;
  transition: opacity var(--transition-duration) ease, color var(--transition-duration) ease;
}

.lang-switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  width: 100%;
  height: 100%;
}

.lang-switch:hover,
.lang-switch:focus-visible {
  opacity: 1;
  color: var(--link);
}

.theme-toggle-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 10px;
  height: 10px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background-color: #000000;
  cursor: pointer;
  outline: none;
  opacity: 0.85;
  transition: transform 150ms ease, opacity 200ms ease, background-color 200ms ease;
}

.theme-toggle-btn:hover {
  opacity: 1;
  transform: scale(1.3);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.theme-toggle-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  width: 100%;
  height: 100%;
}

html[data-theme="dark"] .theme-toggle-btn,
[data-theme="dark"] .theme-toggle-btn {
  background-color: #ffffff;
}

em,
i {
  font-style: italic;
  letter-spacing: 0.01em;
}

.site-shell {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100vw;
  height: auto;
  overflow: hidden;
}

.text-panel {
  height: 100%;
  transition:
    color var(--transition-duration) ease,
    background-color var(--transition-duration) ease;
  display: flex;
  flex-direction: column;
  width: 100vw;
  padding: 0 var(--page-gutter) 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-size: var(--display-size);
  line-height: var(--display-leading);
  hyphens: none;
  overflow-wrap: normal;
  scrollbar-width: none;
  word-break: keep-all;
  -webkit-hyphens: none;
}

.text-panel::-webkit-scrollbar {
  display: none;
}

.text-panel.is-active {
  width: 100vw;
  font-size: var(--display-size);
  line-height: var(--display-leading);
}

.text-panel h1,
.text-panel h2,
.text-panel p,
.text-panel dl,
.text-panel dt,
.text-panel dd {
  margin: 0;
  padding: 0;
  font: inherit;
}

.text-panel h1 {
  margin-bottom: var(--page-gutter);
}

.intro-copy {
  min-width: 0;
  transition: color var(--transition-duration) ease;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--section-grid-gap);
  align-items: start;
}

.inline-image {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  line-height: 0;
  vertical-align: middle;
  cursor: pointer;
}

.inline-image img {
  display: block;
  width: auto;
  height: calc(0.8 * var(--display-leading));
  margin: 0;
  object-fit: cover;
  transition:
    height var(--transition-duration) ease,
    filter var(--transition-duration) ease;
}

.profile-columns {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: var(--section-grid-gap);
  row-gap: var(--section-grid-gap);
  align-items: start;
  margin-top: 0;
  padding-left: var(--section-grid-gap);
  border-left: 1px solid var(--ink);
}

.profile-column {
  min-width: 0;
  align-self: stretch;
  border: 0;
  border-top: 1px solid var(--ink);
  color: inherit;
}

#history-workshops {
  border-top: 0;
}

.profile-column > h2:not(.visually-hidden) {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: calc(var(--section-cell-height) - var(--section-rule));
  margin: 0;
  padding: 0;
  font: inherit;
  text-align: left;
}

.source-copy {
  padding: 0 0 var(--page-gutter);
  font-size: inherit;
  line-height: inherit;
  overflow-wrap: normal;
}

.source-group + .source-group {
  margin-top: var(--display-leading);
}

.source-group h3 {
  margin: 0;
  padding: 0;
  font: inherit;
}

#history-workshops .source-group h3,
#work .source-group h3 {
  margin-bottom: calc(var(--display-leading) / 2);
}

.source-list {
  margin: 0;
  padding: 0 0 0 var(--display-leading);
  list-style: none;
  line-height: calc(var(--display-leading) + 3px);
  text-align: left;
}


.source-list li + li {
  margin-top: 0;
}

body.inline-image-hover .text-panel,
body.inline-image-hover .profile-columns {
  color: var(--muted-ink);
}

body.inline-image-hover .text-panel .inline-image:not(:hover) img {
  filter: grayscale(1) opacity(0.6);
}

.image-popup {
  width: max-content;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  opacity: 0;
  transition: opacity 220ms ease;
}

.image-popup.is-visible {
  opacity: 1;
}

.image-popup::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background-color 220ms ease;
}

.image-popup.is-visible::backdrop {
  background: rgba(0, 0, 0, 0.18);
}

.popup-frame {
  max-width: 100%;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  margin: 0;
}

.popup-media {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
}

.popup-media img {
  display: block;
  width: auto;
  max-width: calc(100vw - 44px);
  height: auto;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  object-fit: contain;
}

#popup-caption {
  position: absolute;
  z-index: 3;
  right: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  margin: 0;
  padding: 3px 5px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  font-size: var(--compact-size);
  line-height: var(--compact-leading);
  overflow-wrap: anywhere;
  pointer-events: none;
  text-align: left;
}

@media (min-width: 769px) {
  .text-panel {
    overflow-y: hidden;
  }

  .profile-layout {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .intro-copy,
  .profile-columns {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .intro-copy::-webkit-scrollbar,
  .profile-columns::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --display-size: 16px;
    --display-leading: 25px;
    --page-gutter: 15px;
    --section-grid-gap: 12px;
    --section-cell-height: 60px;
  }

  .theme-toggle-btn {
    right: 24px;
    bottom: 24px;
  }

  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .site-shell {
    height: auto;
    overflow: visible;
  }

  .text-panel,
  .text-panel.is-active {
    width: 100vw;
    height: auto;
    overflow-y: visible;
  }

  .text-panel h1 {
    margin-bottom: var(--page-gutter);
  }

  .global-nav {
    gap: 20px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    font-size: 16px;
    line-height: 22px;
  }

  .global-nav::-webkit-scrollbar {
    display: none;
  }

  .profile-columns {
    grid-template-columns: 1fr;
    row-gap: 16px;
    margin-top: 16px;
    padding-left: 0;
    border-left: 0;
  }

  #history-workshops {
    padding-top: 16px;
    border-top: 1px solid var(--ink);
  }

  .profile-layout {
    display: block;
  }



  .image-popup {
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .popup-frame {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .popup-media img {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
  }
}

@media (max-width: 380px) {
  .global-nav {
    gap: 12px;
  }
}

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

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

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121212;
    --ink: #f0f0f0;
    --muted-ink: rgba(240, 240, 240, 0.6);
    --link: #6ea8fe;
  }

  .image-popup.is-visible::backdrop {
    background: rgba(0, 0, 0, 0.7);
  }

  :root:not([data-theme="light"]) .theme-toggle-btn {
    background-color: #ffffff;
  }
}
