/* ==========================================================
   안예리 홈페이지
   색은 아래 :root 의 값만 바꾸면 사이트 전체에 반영됩니다.
   ========================================================== */

:root {
  --bg: #FFFFFF;          /* 바탕: 흰색 (그림이 가장 잘 보이는 바탕) */
  --tint: #F5F5F3;        /* 정보 구역 바탕: 아주 옅은 회색 */
  --panel: #EDEDEA;       /* 그림 자리 바탕 */
  --ink: #1A1A1A;         /* 본문·제목 글자 */
  --muted: #666663;       /* 보조 글자 */
  --line: #E3E3DF;        /* 구분선 */
  --wine: #8A2228;        /* 포인트 색: 버튼·선택 표시에만 */
  --on-wine: #FFFFFF;     /* 포인트 색 위 글자 */
  --dark: #1A1A1A;        /* 연락 구역 바탕 */
  --on-dark: #F2F2F0;     /* 어두운 바탕 위 글자 */

  --sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --title: "Instrument Serif", Georgia, "Times New Roman", serif;   /* 영어 타이틀 (기울임) */
  --head: "IBM Plex Sans KR", var(--sans);                         /* 한글 제목 */
  --nav: "Gulim", "굴림", Arial, Helvetica, sans-serif;               /* 목차: 굴림 느낌 */

  --container: 76rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 4rem;
}

/* ---------- 언어 전환 ---------- */
html[data-lang="ko"] [lang="en"],
html[data-lang="en"] [lang="ko"] { display: none !important; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, h3, figure, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }
cite { font-style: italic; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: #BDBDB8;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 30;
  padding: 0.5rem 0.9rem;
  background: var(--wine);
  color: var(--on-wine);
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

/* ---------- 머리글 ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.masthead.is-scrolled { border-bottom-color: var(--line); }

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: var(--container);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  font-family: var(--title);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
  font-family: var(--nav);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
}
.nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--wine); }

.lang-switch { display: flex; font-family: var(--nav); font-size: 0.8rem; font-weight: 400; }
.lang-switch button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button[aria-pressed="true"] { color: var(--wine); }

/* ---------- 첫 화면 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-top: clamp(2.5rem, 7vh, 5rem);
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

.hero-role {
  font-family: var(--head);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.hero-title {
  font-family: var(--title);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.6rem, 5vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.hero-sub {
  margin-top: 1.1rem;
  font-family: var(--head);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  font-weight: 500;
  line-height: 1.6;
  max-width: 30em;
}

.hero-intro {
  margin-top: 1.1rem;
  color: var(--muted);
  max-width: 34rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  background: var(--wine);
  color: var(--on-wine);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  transition: background-color 0.2s;
}
.btn:hover { background: #6F1A20; }

.link { color: var(--muted); font-weight: 500; }

/* ---------- 그림 칸 ---------- */
.frame {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel);
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
}
.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.frame--hero { aspect-ratio: 4 / 5; border-radius: 6px; }
.frame--cover { aspect-ratio: 3 / 4; }

/* 아직 그림을 올리지 않은 칸: 올려야 할 파일 이름을 보여 줍니다 */
.frame.is-empty { cursor: default; }
.frame.is-empty::after {
  content: attr(data-file);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  font: 500 0.8rem/1.4 var(--sans);
  color: var(--muted);
  text-align: center;
}

/* ---------- 섹션 ---------- */
.section {
  padding: clamp(4rem, 9vh, 6.5rem) 0;
}
#works { border-top: 1px solid var(--line); }
#research, #cv { background: var(--tint); }

.section-title {
  font-family: var(--title);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 2.75rem;
}

.sub-title {
  font-family: var(--head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 3.25rem 0 1.25rem;
}
.section-title + .sub-title,
.cols > div > .sub-title:first-child { margin-top: 0; }

.grid { display: grid; gap: 2.25rem 1.25rem; }
.grid--serial { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.work figcaption { margin-top: 0.85rem; }
.work-title { font-family: var(--head); font-weight: 600; line-height: 1.45; }
.work-meta { margin-top: 0.2rem; font-size: 0.875rem; line-height: 1.55; color: var(--muted); }

.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem clamp(2rem, 5vw, 4.5rem);
  margin-top: 3.25rem;
}
.section-title + .cols { margin-top: 0; }
.cols .sub-title:not(:first-child) { margin-top: 3rem; }

/* 연도 + 내용 목록 */
.rows li {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.rows li:last-child { border-bottom: 1px solid var(--line); }
.when {
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}
.paper { display: block; font-family: var(--head); font-weight: 600; }
.paper-meta { display: block; margin-top: 0.15rem; font-size: 0.9rem; color: var(--muted); }

/* 관심 주제 */
.topics { display: grid; gap: 1.75rem; }
.topics dt { font-family: var(--head); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.3rem; }
.topics dd { color: var(--muted); }

/* ---------- 연락 ---------- */
.contact {
  padding: clamp(4.5rem, 10vh, 7rem) 0;
  background: var(--dark);
  color: var(--on-dark);
}
.contact .section-title { color: var(--on-dark); margin-bottom: 1.5rem; }
.contact-lead { font-size: 1.15rem; margin-bottom: 1.5rem; opacity: 0.9; }
.mail {
  font-weight: 700;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
  text-decoration-color: rgba(242, 242, 240, 0.4);
}
.mail:hover { text-decoration-color: var(--on-dark); }

.colophon {
  background: var(--dark);
  color: rgba(242, 242, 240, 0.6);
  font-size: 0.85rem;
}
.colophon .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid rgba(242, 242, 240, 0.15);
}

/* ---------- 크게 보기 ---------- */
.viewer {
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--on-dark);
  overflow: visible;
}
.viewer::backdrop { background: rgba(20, 20, 20, 0.9); }
.viewer img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: 4px;
}
.viewer-caption { margin-top: 0.9rem; text-align: center; font-size: 0.95rem; }
.viewer-caption .work-meta { color: rgba(242, 242, 240, 0.75); }
.viewer-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  font: 600 0.9rem var(--sans);
  color: var(--on-dark);
  background: none;
  border: 0;
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .viewer[open] { animation: viewer-in 0.2s ease-out; }
}
@keyframes viewer-in { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- 태블릿 ---------- */
@media (max-width: 960px) {
  .grid--serial { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cols .sub-title { margin-top: 3rem; }
  .cols > div:first-child > .sub-title:first-child { margin-top: 0; }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 720px) {
  :root { --header-h: 6rem; }
  .masthead-inner { flex-wrap: wrap; column-gap: 1rem; row-gap: 0; padding-top: 0.6rem; }
  .lang-switch { margin-left: auto; }
  .nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.5rem 0 0.75rem;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 2rem; }
  .hero-figure { order: -1; }
  .frame--hero { aspect-ratio: 4 / 4.4; }

  .grid { gap: 1.75rem 0.9rem; }
  .rows li { grid-template-columns: 4.75rem minmax(0, 1fr); gap: 0.75rem; }
  .colophon .wrap { flex-direction: column; gap: 0.2rem; }
}

@media print {
  .masthead, .skip, .viewer { display: none; }
  .contact, .colophon { background: none; color: var(--ink); }
}
