/* ─────────────────────────────────────────────
   Gary Rhee · 라이트 베이지 테마
   Cinzel (영문 헤딩) + Pretendard (한국어) + Spectral (영문 본문)
───────────────────────────────────────────── */

:root {
  --bg:         #F5EFE3;
  --surface:    #FFFFFF;
  --surface-2:  #EDE5D4;
  --border:     #C9B898;
  --gold:       #9A6820;
  --gold-faint: rgba(154,104,32,.10);
  --text:       #1E1208;
  --muted:      #6B4C2A;
  --glow:       0 2px 10px rgba(154,104,32,.14);
  --glow-lg:    0 6px 28px rgba(154,104,32,.18);

  /* 보색 다크 팔레트 (골드 ↔ 네이비) */
  --navy:       #0D1F3C;
  --dark-alt:   #13202F;
  --on-dark:    #EAE0CC;
  --on-dark-m:  rgba(234,224,204,.6);
  --gold-light: #C89040;

  --max: 1120px;
  --font-h: 'Cinzel', 'Pretendard', 'Malgun Gothic', sans-serif;
  --font-b: 'Spectral', 'Pretendard', 'Malgun Gothic', sans-serif;
  --font-kr: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* ── Signature Gold — selection / focus-ring / scrollbar ─ */
::selection { background: rgba(154,104,32,.18); }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}
html {
  scrollbar-color: rgba(154,104,32,.28) transparent;
  scrollbar-width: thin;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(154,104,32,.28); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(154,104,32,.5); }

/* ── 텍스처 레이어 — 미세 종이 노이즈 ──────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
  opacity: 0.045;
  mix-blend-mode: overlay;
}

/* ── Nav ───────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.1rem clamp(1.25rem, 5vw, 3.5rem);
  background: rgba(245,239,227,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s, padding .35s;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__brand {
  font-family: var(--font-h); font-size: 1.1rem;
  letter-spacing: .06em; color: var(--text);
  display: flex; align-items: center; gap: .5rem;
}
.nav__brand-sep { color: var(--gold); opacity: .7; }
.nav__brand-en  { color: var(--gold); font-size: .75rem; letter-spacing: .14em; }

.nav__links { display: flex; gap: 2rem; }
.nav__links a {
  font-family: var(--font-h); font-size: .85rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); transition: color .25s;
  position: relative; padding-bottom: 3px;
}
.nav__links a::after {
  content: ''; position: absolute;
  bottom: -1px; left: 0; right: 0; height: 1px;
  background: var(--gold);
  transform: scaleX(0); transform-origin: right;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.nav__links a:hover { color: var(--gold); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

.lang-toggle {
  font-family: var(--font-h); font-size: .68rem; letter-spacing: .1em;
  background: none; border: none; cursor: pointer;
  color: var(--muted); display: flex; gap: .3rem; align-items: center;
}
.lang-toggle__opt.is-active { color: var(--gold); }
.lang-toggle__sep { opacity: .35; }

/* ── Hero ──────────────────────────────────── */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem clamp(1.25rem, 5vw, 3.5rem) 3rem;
  position: relative;
  overflow: hidden;
}

/* GLSL Hills canvas */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
#hero-canvas.is-ready { opacity: 1; }

.hero__inner {
  max-width: var(--max); margin: 0 auto; width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Portrait — LEFT, larger */
.hero__portrait { order: 0; }
.hero__portrait img {
  width: clamp(260px, 32vw, 420px);
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: var(--glow-lg);
  display: block;
}

/* Text — RIGHT */
.hero__text { order: 1; }

.hero__name {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin-bottom: 1rem;
}
/* 이경록 and Gary Rhee — same font stack, same weight, no italic */
.hero__name-ko {
  font-family: var(--font-kr);
  font-weight: 700;
  font-style: normal;
  font-size: clamp(3.8rem, 9vw, 7rem);
  line-height: 1.0;
  letter-spacing: -.02em;
  color: var(--text);
}
.hero__name-en {
  font-family: 'Cinzel', 'Noto Serif KR', serif;
  font-weight: 600;
  font-style: normal;
  font-size: clamp(1.8rem, 4.5vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: .06em;
  color: var(--gold);
}

.hero__role {
  font-family: var(--font-h);
  font-size: 1.05rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
  padding-left: .9rem;
  border-left: 2px solid var(--gold);
  margin-bottom: 2.4rem;
  line-height: 1.6;
}

/* Buttons */
.btn {
  font-family: var(--font-h);
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .78rem 1.8rem; border-radius: 4px;
  border: 1px solid; cursor: pointer;
  transition: background .25s, color .25s, border-color .25s,
              transform .28s cubic-bezier(.2,0,0,1),
              box-shadow .28s cubic-bezier(.2,0,0,1);
  display: inline-block;
}
.btn--primary {
  background: var(--gold); color: #FFFFFF; border-color: #7A5318;
}
.btn--primary:hover {
  background: #7A5318;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(154,104,32,.38);
}
.btn--ghost {
  background: transparent; color: var(--muted); border-color: var(--border);
}
.btn--ghost:hover {
  border-color: var(--gold); color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(154,104,32,.18);
}
.btn:disabled { opacity: .45; cursor: default; }

.hero__org-link {
  font-family: var(--font-h);
  font-size: .85rem; letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 1.8rem;
  display: flex; align-items: center; gap: .4rem;
}
.hero__org-link a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity .2s;
}
.hero__org-link a:hover { opacity: .75; }

.hero__cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  font-family: var(--font-h); font-size: .62rem; letter-spacing: .32em;
  color: var(--muted); opacity: .5;
  animation: float 2.4s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(7px); }
}

/* ── Sections ──────────────────────────────── */
.section {
  border-top: 1px solid var(--border);
}
.section__inner {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 5vw, 3.5rem);
}
.section__head {
  display: flex; align-items: baseline; gap: 1rem;
  margin-bottom: 2.8rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid rgba(154,104,32,.18);
}
.section__num {
  font-family: var(--font-h); font-size: 1.5rem; letter-spacing: .08em;
  color: var(--gold); line-height: 1;
}
.section__title {
  font-family: var(--font-h); font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: .06em;
}

/* ── 섹션별 배경 — 골드↔네이비 보색 대비 ─── */
#about {
  background: var(--navy);
  border-top-color: rgba(154,104,32,.35);
  color: var(--on-dark);
}
#connect {
  background: var(--dark-alt);
  border-top-color: rgba(154,104,32,.25);
  color: var(--on-dark);
}

/* About 다크 섹션 텍스트 */
#about .section__num   { color: var(--gold-light); }
#about .section__title { color: var(--on-dark); }
#about .about__p       { color: var(--on-dark-m); letter-spacing: .01em; }
#about .about__p strong { color: var(--on-dark); }

/* Connect 다크 섹션 텍스트 */
#connect .section__num   { color: var(--gold-light); }
#connect .section__title { color: var(--on-dark); }
#connect .connect__lead  { color: var(--on-dark-m); }
#connect .contact-form input,
#connect .contact-form textarea {
  background: rgba(255,255,255,.06);
  border-color: rgba(200,184,152,.2);
  color: var(--on-dark);
}
#connect .contact-form input::placeholder,
#connect .contact-form textarea::placeholder { color: rgba(234,224,204,.35); }
#connect .contact-form input:focus,
#connect .contact-form textarea:focus {
  border-color: var(--gold-light);
  background: rgba(255,255,255,.1);
  box-shadow: 0 0 0 2px rgba(154,104,32,.22);
}
#connect .btn--primary {
  background: var(--gold-light); border-color: var(--gold);
}
#connect .form-note { color: var(--on-dark-m); }

/* Projects 섹션 번호 */
#projects .section__num { color: var(--text); opacity: .5; }

/* ── About ─────────────────────────────────── */
.about__body { max-width: 66ch; }
.about__p {
  font-family: var(--font-kr);
  font-size: 1.02rem; line-height: 1.95;
  color: var(--muted); margin-bottom: 1.5rem;
  letter-spacing: -.01em;
  word-break: keep-all; /* 한국어 단어 잘림 방지 */
}
.about__p strong { color: var(--text); font-weight: 500; }
.about__p--last {
  margin-bottom: 0;
}

/* ── Projects Grid ─────────────────────────── */
.projects__note {
  font-family: var(--font-kr);
  font-size: .88rem; color: var(--muted);
  line-height: 1.65; margin-bottom: 2.2rem;
}

.proj-section { margin-bottom: 3rem; }
.proj-section:last-child { margin-bottom: 0; }
.proj-section__label {
  font-family: var(--font-h);
  font-size: .82rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.4rem;
}

/* Toy 섹션 — Featured와 시각적으로 분리 */
.proj-section:not(.proj-section--featured) {
  padding-top: 2.2rem;
  border-top: 1px dashed rgba(154,104,32,.2);
}
.proj-section:not(.proj-section--featured) .proj-section__label {
  color: var(--text);
  opacity: .6;
  font-size: .78rem;
  letter-spacing: .22em;
}
.proj-section__label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
/* Toy Projects — 4열, 카드 작게 */
.proj-grid--toy {
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
}
.proj-grid--toy .proj-card {
  padding: 1.1rem 1.1rem;
  gap: .4rem;
  border-top-width: 2px;
}
.proj-grid--toy .proj-card__tag {
  font-size: .72rem;
}
.proj-grid--toy .proj-card__title {
  font-size: .93rem;
}
.proj-grid--toy .proj-card__desc {
  font-size: .82rem;
  line-height: 1.55;
}
a.proj-card { text-decoration: none; color: inherit; }
.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: 6px;
  padding: 1.6rem 1.5rem;
  display: flex; flex-direction: column; gap: .6rem;
  box-shadow: 0 2px 12px rgba(154,104,32,.09);
  transition: box-shadow .38s cubic-bezier(.2,0,0,1),
              transform .38s cubic-bezier(.2,0,0,1),
              border-color .25s;
}
.proj-card:hover {
  box-shadow: 0 12px 40px rgba(154,104,32,.22);
  transform: translateY(-6px);
  border-color: rgba(154,104,32,.45);
}
.proj-card__tag {
  font-family: var(--font-h);
  font-size: .8rem; letter-spacing: .11em; text-transform: uppercase;
  color: var(--gold);
}
.proj-card__title {
  font-family: var(--font-kr); font-weight: 600;
  font-size: 1.05rem; color: var(--text); letter-spacing: -.01em;
}
.proj-card__desc {
  font-family: var(--font-kr);
  font-size: .88rem; color: var(--muted); line-height: 1.65;
}

/* ── Featured 섹션 강조 ────────────────────── */
.proj-section--featured {
  background: linear-gradient(155deg, rgba(154,104,32,.07) 0%, rgba(154,104,32,.01) 60%, transparent 100%);
  border-radius: 14px;
  padding: 1.8rem 2.2rem;
  margin: 0 -2.2rem 0;
  border-top: none; /* override toy's dashed border */
}
.proj-section--featured .proj-section__label {
  color: var(--gold);
  font-size: .82rem;
}
.proj-section--featured .proj-section__label::before {
  content: '✦';
  margin-right: .45rem;
  font-size: .68rem;
  opacity: .8;
}

.proj-section--featured .proj-card {
  border-top: 5px solid var(--gold);
  padding: 2.1rem 1.9rem;
  gap: .75rem;
  background: linear-gradient(148deg, #fff 62%, rgba(154,104,32,.055) 100%);
  box-shadow: 0 4px 22px rgba(154,104,32,.13);
}
.proj-section--featured .proj-card:hover {
  box-shadow: 0 20px 60px rgba(154,104,32,.34);
  transform: translateY(-10px) scale(1.015);
  border-color: rgba(154,104,32,.55);
}
.proj-section--featured .proj-card__tag  { font-size: .75rem; }
.proj-section--featured .proj-card__title {
  font-size: 1.14rem;
  letter-spacing: -.015em;
}
.proj-section--featured .proj-card__desc {
  font-size: .91rem;
  line-height: 1.72;
}

/* ── Connect ───────────────────────────────── */
.connect__lead {
  font-family: var(--font-kr);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 400; line-height: 1.75;
  color: var(--muted); max-width: 42ch;
  margin-bottom: 2.5rem;
  word-break: keep-all;
}
.contact-form { max-width: 560px; display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact-form input,
.contact-form textarea {
  font-family: var(--font-kr); font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: .9rem 1rem; width: 100%;
  transition: border-color .25s, box-shadow .25s;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--muted); opacity: .6; }
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-faint); }
.contact-form textarea { resize: vertical; min-height: 130px; line-height: 1.65; }
.contact-form .btn { align-self: flex-start; margin-top: .3rem; }
.form-note { font-family: var(--font-b); font-size: .88rem; margin-top: .2rem; }
.form-note.is-ok    { color: #4ade80; }
.form-note.is-error { color: #f87171; }

/* ── Footer ────────────────────────────────── */
.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 3rem clamp(1.25rem, 5vw, 3.5rem) 4rem;
  border-top: 1px solid var(--border);
}
.footer__links { display: flex; gap: 1.8rem; margin-bottom: 2rem; }
.footer__links a {
  font-family: var(--font-h); font-size: .8rem;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); transition: color .25s;
}
.footer__links a:hover { color: var(--gold); }
.footer__meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-family: var(--font-h); font-size: .64rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); opacity: .6;
}

/* ── Reveal ────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .85s cubic-bezier(.4,0,.2,1),
              transform .85s cubic-bezier(.4,0,.2,1);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ── 스크롤 스토리텔링 — Hero 진입 애니메이션 ─ */
@keyframes hero-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
.hero__portrait { animation: hero-in .72s cubic-bezier(.4,0,.2,1) .04s both; }
.hero__name     { animation: hero-in .72s cubic-bezier(.4,0,.2,1) .14s both; }
.hero__role     { animation: hero-in .72s cubic-bezier(.4,0,.2,1) .25s both; }
.hero__org-link { animation: hero-in .72s cubic-bezier(.4,0,.2,1) .34s both; }
.hero__cta      { animation: hero-in .72s cubic-bezier(.4,0,.2,1) .43s both; }

/* ── Responsive ────────────────────────────── */

/* 좌우 스크롤 전역 차단 */
html { overflow-x: hidden; }
body { overflow-x: hidden; }

/* ── 태블릿 (≤820px) ── */
@media (max-width: 820px) {
  .nav__links { display: none; }

  /* Hero */
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  .hero__portrait { order: -1; display: flex; justify-content: center; }
  .hero__portrait img { width: 150px; }
  /* 좌측 보더 → 하단 보더로 (센터 정렬 시 어색함 방지) */
  .hero__role {
    border-left: none;
    padding-left: 0;
    border-bottom: 2px solid var(--gold);
    padding-bottom: .45rem;
    display: inline-block;
  }
  .hero__org-link { justify-content: center; }
  .hero__cta { justify-content: center; }

  /* Grids */
  .proj-grid         { grid-template-columns: repeat(2, 1fr); }
  .proj-grid--toy    { grid-template-columns: repeat(2, 1fr); }
  .form-row          { grid-template-columns: 1fr; }

  /* Featured 섹션 — 네거티브 마진 제거 (오버플로 원인) */
  .proj-section--featured {
    padding: 1.5rem 1.4rem;
    margin: 0 0 3rem;
    border-radius: 10px;
  }
}

/* ── 소형 태블릿 / 큰 폰 (≤600px) ── */
@media (max-width: 600px) {
  /* 폰트 스케일 조정 */
  .hero__name-ko { font-size: clamp(3rem, 14vw, 4.2rem); }
  .hero__name-en { font-size: clamp(1.4rem, 5.5vw, 2rem); }
  .hero__role    { font-size: .92rem; }

  /* Featured 카드 1열 */
  .proj-section--featured .proj-grid { grid-template-columns: 1fr; }
  .proj-section--featured {
    padding: 1.2rem 1rem;
    margin: 0;
    border-radius: 8px;
  }

  /* Toy: 2열 유지 */
  .proj-grid--toy { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .proj-grid--toy .proj-card { padding: .95rem .9rem; }
}

/* ── 모바일 (≤460px) ── */
@media (max-width: 460px) {
  /* 섹션 수직 패딩 줄이기 */
  .section__inner {
    padding-top: clamp(2.5rem, 8vw, 4rem);
    padding-bottom: clamp(2.5rem, 8vw, 4rem);
  }

  /* 그리드 전부 1열 */
  .proj-grid     { grid-template-columns: 1fr; }
  .proj-grid--toy { grid-template-columns: 1fr; }

  /* 탭 터치 타겟 최소 44px 확보 */
  .footer__links { flex-direction: column; gap: .2rem; }
  .footer__links a {
    padding: .65rem 0;
    min-height: 44px;
    display: flex; align-items: center;
  }
  .hero__cta .btn { padding: .9rem 1.5rem; min-height: 44px; }

  /* 푸터 메타 세로 쌓기 */
  .footer__meta { flex-direction: column; gap: .4rem; }

  /* Toy 섹션 라벨 구분 여백 */
  .proj-section:not(.proj-section--featured) { padding-top: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-cue { animation: none; }
  .btn { transition: none; }
  .proj-card { transition: none; }
  .hero__portrait, .hero__name, .hero__role, .hero__org-link, .hero__cta {
    animation: none;
    opacity: 1; transform: none;
  }
}
