@font-face {
  font-family: Pretendard;
  src: url('/fonts/pretendard-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --surface: #faf9f6;
  --surface-dark: #171c1a;
  --ink: #202824;
  --ink-dark: #edf2ee;
  --muted: #5f6b65;
  --muted-dark: #b3beb7;
  --divider: #dce2dc;
  --divider-dark: #47544b;
  --accent: #b42318;
  --accent-dark: #ff8c7d;
  --role-red: #b42318;
  --accent-tint: #f9ece9;
  --accent-tint-dark: #33231f;
  --focus: #b42318;
  --brand-black: #000000;
  --brand-light: #f5f7f5;
  --brand-linkedin: #0a66c2;
  --brand-youtube: #ff0033;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --content-width: 720px;
  --profile-column: 272px;
  --flip-duration: 600ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --surface: var(--surface-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --divider: var(--divider-dark);
    --accent: var(--accent-dark);
    --role-red: var(--accent-dark);
    --accent-tint: var(--accent-tint-dark);
    --focus: var(--accent-dark);
    --brand-black: var(--brand-light);
  }
  :root:not([data-theme]) .icon-link img { filter: grayscale(1) brightness(0) invert(.72); }
  :root:not([data-theme]) .link-card img[src^="/covers/"] { filter: invert(1) hue-rotate(180deg); }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface: var(--surface-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --divider: var(--divider-dark);
    --accent: var(--accent-dark);
    --role-red: var(--accent-dark);
    --accent-tint: var(--accent-tint-dark);
    --focus: var(--accent-dark);
    --brand-black: var(--brand-light);
  }
  :root[data-theme="dark"] .icon-link img { filter: grayscale(1) brightness(0) invert(.72); }
  :root[data-theme="dark"] .link-card img[src^="/covers/"] { filter: invert(1) hue-rotate(180deg); }

* { box-sizing: border-box; }
html { background: var(--surface); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
  font-family: Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, .link-track:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
h1, h2, p, ul { margin-top: 0; }
.page { min-height: 100dvh; }
.container { width: 100%; max-width: var(--content-width); margin-inline: auto; padding: var(--space-16) var(--space-6); }

.profile-header { display: flex; position: relative; align-items: flex-start; gap: var(--space-8); margin-bottom: var(--space-12); }
.profile-controls { display: flex; position: absolute; top: 0; right: 0; }
.language-switch, .theme-switch { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: var(--muted); text-decoration: none; cursor: pointer; }
.language-switch svg, .theme-switch svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.language-switch:hover, .theme-switch:hover { color: var(--accent); }
.theme-switch .theme-sun { display: none; }
:root[data-theme="dark"] .theme-switch .theme-moon { display: none; }
:root[data-theme="dark"] .theme-switch .theme-sun { display: block; }
.portrait-flip { display: block; width: 120px; height: 127px; flex: 0 0 120px; padding: 0; border: 0; border-radius: var(--space-6); background: none; perspective: 900px; cursor: pointer; }
.portrait-inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform var(--flip-duration) cubic-bezier(.22, .61, .36, 1); }
.portrait-flip.is-flipped .portrait-inner { transform: rotateY(180deg); }
.portrait-face { display: block; position: absolute; inset: 0; overflow: hidden; border-radius: var(--space-6); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.portrait-face--back { transform: rotateY(180deg); }
.portrait-face img { display: block; width: 120px; height: 127px; object-fit: cover; }
.profile-details { min-width: 0; flex: 1; }
.eyebrow { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); color: var(--role-red); font-size: 14px; font-weight: 600; line-height: 20px; letter-spacing: .06em; }
.role-emoji { font-size: 15px; line-height: 1; letter-spacing: normal; }
h1 { margin-bottom: var(--space-3); font-size: 40px; font-weight: 700; line-height: 46px; letter-spacing: -.035em; overflow-wrap: anywhere; }
.social-links { display: flex; align-items: center; margin-left: -10px; }
.icon-link { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; color: var(--muted); }
.icon-link svg, .icon-link img { display: block; width: 20px; height: 20px; }
.icon-link svg { fill: currentColor; }
.icon-link img { filter: grayscale(1) brightness(.55); }
.icon-link[data-platform="huggingface"] img { width: 24px; height: 24px; }
.icon-link[data-platform="huggingface"]:is(:hover, :focus-visible) img,
.icon-link[data-platform="instagram"]:is(:hover, :focus-visible) img { filter: none; }
.icon-link[data-platform="github"]:is(:hover, :focus-visible) { color: var(--brand-black); }
.icon-link[data-platform="linkedin"]:is(:hover, :focus-visible) { color: var(--brand-linkedin); }
.icon-link[data-platform="x"]:is(:hover, :focus-visible) { color: var(--brand-black); }
.icon-link[data-platform="youtube"]:is(:hover, :focus-visible) { color: var(--brand-youtube); }

.bio { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-12); font-size: 16px; line-height: 24px; }
.bio p { margin-bottom: 0; }
.bio a { text-decoration: underline; text-underline-offset: 1px; }
.bio a:hover { color: var(--accent); }
.bio ul { margin-bottom: 0; padding-left: 0; list-style: none; }
.bio li { position: relative; padding-left: var(--space-6); }
.bio li + li { margin-top: var(--space-3); }
.bio li::before { position: absolute; top: var(--space-2); left: var(--space-1); width: var(--space-1); height: var(--space-1); border-radius: 50%; background: var(--accent); content: ''; }
html[lang="ko"] .bio { overflow-wrap: anywhere; word-break: keep-all; }

h2 { margin-bottom: var(--space-1); font-size: 24px; font-weight: 700; line-height: 32px; }
h2.section-heading { margin-bottom: var(--space-6); }
.link-preview { position: fixed; z-index: 10; box-sizing: border-box; width: min(320px, calc(100vw - 24px)); overflow: hidden; border: 1px solid var(--divider); border-radius: var(--space-4); background: var(--surface); pointer-events: none; }
.link-preview[hidden], .link-preview-image[hidden], .link-preview-description[hidden] { display: none; }
.link-preview-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.link-preview-copy { display: grid; gap: var(--space-2); padding: var(--space-4); }
.link-preview-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 16px; font-weight: 600; line-height: 24px; }
.link-preview-description { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; color: var(--muted); font-size: 14px; line-height: 20px; }
.link-preview-domain { color: var(--muted); font-size: 14px; line-height: 20px; }
.link-track { display: flex; gap: var(--space-4); overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 0 0 var(--space-3); scrollbar-color: var(--divider) transparent; scrollbar-width: thin; }
.link-card { display: block; flex: 0 0 260px; overflow: hidden; border: 1px solid var(--divider); border-radius: var(--space-4); background: var(--surface); scroll-snap-align: start; text-decoration: none; }
.link-card:hover { border-color: var(--accent); }
.link-card:active { background: var(--accent-tint); }
.link-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--accent-tint); }
.card-copy { display: block; padding: var(--space-4); }
.card-domain { display: block; margin-bottom: var(--space-2); color: var(--muted); font-size: 14px; line-height: 20px; }
.card-title { display: -webkit-box; min-height: 48px; margin-bottom: var(--space-1); overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; word-break: keep-all; text-wrap: balance; font-size: 16px; font-weight: 600; line-height: 24px; }
.card-description { display: -webkit-box; min-height: 60px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow-wrap: anywhere; word-break: keep-all; text-wrap: balance; color: var(--muted); font-size: 14px; line-height: 20px; }
.link-card:hover .card-title { color: var(--accent); }
.empty-message { color: var(--muted); font-size: 14px; line-height: 20px; }

@media (min-width: 640px) { .container { padding: var(--space-20) var(--space-8); } }
@media (min-width: 640px) and (max-width: 959px) { .profile-details { padding-right: calc(var(--space-20) + var(--space-2)); } }
@media (min-width: 960px) {
  .container { max-width: 1088px; }
  main { display: grid; grid-template-columns: var(--profile-column) minmax(0, 1fr); column-gap: var(--space-16); }
  .profile-header { position: sticky; top: var(--space-20); grid-column: 1; grid-row: 1 / span 2; align-self: start; flex-direction: column; gap: var(--space-6); margin-bottom: 0; }
  .profile-details { flex: none; }
  h1 { font-size: 48px; line-height: 56px; }
  .bio { grid-column: 2; grid-row: 1; }
  .links-section { grid-column: 2; grid-row: 2; }
}
@media (max-width: 639px) {
  .profile-header { flex-direction: column; gap: var(--space-4); }
}
@media (max-width: 359px) {
  .link-card { flex-basis: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .link-track { scroll-behavior: auto; }
  .portrait-inner, .portrait-flip.is-flipped .portrait-inner { transform: none; transition: none; }
  .portrait-face--back { display: none; transform: none; }
  .portrait-flip.is-flipped .portrait-face--front { display: none; }
  .portrait-flip.is-flipped .portrait-face--back { display: block; }
}
