/* ===== Base ===== */
:root {
  --bg: #f2f0ea;          /* warm paper */
  --ink: #1b1a18;         /* near-black */
  --muted: #7c7870;
  --line: #dcd8cd;
  --surface: #f7f5f0;
  --dark: #1b1a18;        /* dark section */
  --dark-soft: #262522;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Typography helpers ===== */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 20px;
}

.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0;
}

.display em {
  font-style: italic;
  font-weight: 500;
}

/* ===== Header / Tabs ===== */
.site-header {
  background: rgba(242, 240, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-logo {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 20px 0;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 22px 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.2s;
}

.tab:hover { color: var(--ink); }

.tab--active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ===== Mobile nav (hamburger + drawer) ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
}

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.mobile-nav__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 26, 24, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 80vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 48px rgba(27, 26, 24, 0.18);
  padding: 72px 28px 28px;
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.mobile-nav.is-open { pointer-events: auto; }
.mobile-nav.is-open .mobile-nav__backdrop { opacity: 1; }
.mobile-nav.is-open .mobile-nav__panel { transform: translateX(0); }

.mobile-nav__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 26, 24, 0.06);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-nav__links {
  display: flex;
  flex-direction: column;
}

.mobile-nav__link {
  padding: 16px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mobile-nav__link:first-child { border-top: 1px solid var(--line); }

.mobile-nav__link.is-current { color: var(--ink); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 120px;
  padding: 32px 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--ink); }

/* ===== Home ===== */
.home-hero {
  padding: 110px 0 72px;
  text-align: center;
}

.home-tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 28px auto 0;
  max-width: 480px;
}

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: opacity 0.2s;
}

.social-btn:hover { opacity: 0.82; }

.social-btn svg { flex-shrink: 0; }

/* ===== Resume ===== */
.resume {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  margin-top: 40px;
  padding-top: 64px;
  border-top: 1px solid var(--line);
}

.resume-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 24px;
}

.resume-col .resume-title + .resume-list { margin-bottom: 48px; }
.resume-col .resume-list:last-child { margin-bottom: 0; }

.resume-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resume-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.resume-list li:first-child { border-top: 1px solid var(--line); }

.resume-period {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.resume-role { font-size: 0.92rem; }
.resume-role a { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Mini Apps page ===== */
.miniapps { padding-top: 96px; }

.miniapps-header { text-align: center; margin-bottom: 64px; }
.miniapps-header p:not(.eyebrow) {
  color: var(--muted);
  margin: 24px auto 0;
  max-width: 440px;
  font-size: 0.95rem;
}

/* ===== Keyboard (realistic) ===== */
.keyboard {
  --kb-gap: 9px;
  display: flex;
  flex-direction: column;
  gap: var(--kb-gap);
  max-width: 992px;
  margin: 0 auto;
  padding: 26px;
  background: linear-gradient(175deg, #2b2a27 0%, #1e1d1b 60%, #191817 100%);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -6px 12px rgba(0, 0, 0, 0.35) inset,
    0 24px 48px -16px rgba(27, 26, 24, 0.45),
    0 4px 10px rgba(27, 26, 24, 0.18);
}

.kb-row {
  display: flex;
  gap: var(--kb-gap);
  justify-content: center;
  width: 100%;
}

.key {
  --key-w: calc((100% - 9 * var(--kb-gap)) / 10);
  position: relative;
  width: var(--key-w);
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  font-family: inherit;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

button.key { cursor: pointer; }

/* 비활성(회색) 키캡 */
.key--disabled,
.key--deco {
  background: linear-gradient(180deg, #3a3936 0%, #312f2c 55%, #2b2a27 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 -3px 4px rgba(0, 0, 0, 0.3) inset,
    0 3px 0 #121110,
    0 5px 6px rgba(0, 0, 0, 0.4);
  color: #7d7a73;
  cursor: default;
  user-select: none;
}

.key-letter {
  font-size: clamp(0.75rem, 1.8vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* 활성 키캡: 크림색 키캡 위에 앱 아이콘 인쇄 */
.key--active {
  background: linear-gradient(180deg, #fbfaf6 0%, #efede5 60%, #e5e2d8 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -3px 4px rgba(27, 26, 24, 0.12) inset,
    0 4px 0 #b9b5a8,
    0 6px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}

.key--active:hover {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -3px 4px rgba(27, 26, 24, 0.12) inset,
    0 3px 0 #b9b5a8,
    0 5px 6px rgba(0, 0, 0, 0.45);
}

.key--disabled.is-pressed,
.key--deco.is-pressed {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 -2px 3px rgba(0, 0, 0, 0.3) inset,
    0 1px 0 #121110,
    0 2px 3px rgba(0, 0, 0, 0.4);
}

.key--active.is-pressed,
.key--active:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -2px 3px rgba(27, 26, 24, 0.14) inset,
    0 0 0 #b9b5a8,
    0 1px 3px rgba(0, 0, 0, 0.4);
}

.key-icon {
  width: 62%;
  height: 62%;
  border-radius: 22%;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(27, 26, 24, 0.25);
}

/* 하단 수식키 줄 */
.key--wide { width: calc(var(--key-w) * 1.5 + var(--kb-gap) * 0.5); aspect-ratio: auto; }
.key--cmd { width: calc(var(--key-w) * 1.25); aspect-ratio: auto; }
.key--space { flex: 1; aspect-ratio: auto; }

.kb-row--bottom .key {
  aspect-ratio: auto;
  height: clamp(30px, 6vw, 58px);
  padding: 0 6px;
}

.key--wide { padding: 0 6px; }

.key-label {
  font-size: clamp(0.5rem, 1.1vw, 0.62rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* 툴팁 */
.key-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
}

.key--active:hover .key-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.miniapps-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 40px;
}

/* 클릭 가능한 장식 키(이스터에그): 밝은 키캡으로 구분 */
.key--egg {
  cursor: pointer;
  background: linear-gradient(180deg, #57544e 0%, #47443f 55%, #3e3b37 100%);
  color: #d3cfc4;
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}

.key--egg:hover {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 -3px 4px rgba(0, 0, 0, 0.3) inset,
    0 2px 0 #121110,
    0 4px 5px rgba(0, 0, 0, 0.4);
}

.key--egg:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 -2px 3px rgba(0, 0, 0, 0.3) inset,
    0 0 0 #121110,
    0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ===== 2048 game ===== */
.game-card { width: min(460px, 100%); }

.game-card .miniapp-modal__close {
  background: rgba(27, 26, 24, 0.08);
  color: var(--ink);
}

.game-card .miniapp-modal__close:hover { background: rgba(27, 26, 24, 0.18); }

.game-head {
  padding: 44px 32px 24px;
  text-align: center;
}

.game-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.2rem;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.game-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 20px;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.game-score-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-score-label b { color: var(--ink); font-size: 0.9rem; margin-left: 4px; }

.btn--dark {
  background: var(--ink);
  color: var(--bg);
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.btn--dark:hover { opacity: 0.85; }

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  width: min(340px, calc(100% - 48px));
  aspect-ratio: 1;
  margin: 0 auto 20px;
  padding: 10px;
  background: var(--dark);
  border-radius: 14px;
  touch-action: none;
}

.game-cell {
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  background: rgba(242, 240, 234, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
}

.game-cell[data-len="3"] { font-size: 1.15rem; }
.game-cell[data-len="4"] { font-size: 0.95rem; }

.game-cell--v2 { background: #f4f1e8; }
.game-cell--v4 { background: #ece3cd; }
.game-cell--v8 { background: #eecf94; }
.game-cell--v16 { background: #e7b45f; }
.game-cell--v32 { background: #de9a41; color: #fff; }
.game-cell--v64 { background: #d47f2c; color: #fff; }
.game-cell--v128 { background: #c9a53c; color: #fff; }
.game-cell--v256 { background: #c19a2b; color: #fff; }
.game-cell--v512 { background: #b78d1e; color: #fff; }
.game-cell--v1024 { background: #a67c10; color: #fff; }
.game-cell--v2048 { background: #1b1a18; color: #eecf94; }

.game-status {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  padding-bottom: 12px;
}

.game-card { padding-bottom: 24px; }

/* ===== Mini App Modal ===== */
.miniapp-modal[hidden] { display: none; }

.miniapp-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.miniapp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 26, 24, 0.55);
  backdrop-filter: blur(6px);
}

.miniapp-modal__card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 20px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.miniapp-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(242, 240, 234, 0.12);
  color: var(--bg);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.miniapp-modal__close:hover { background: rgba(242, 240, 234, 0.24); }

.miniapp-modal__hero {
  background: var(--dark);
  color: var(--bg);
  padding: 72px 40px 56px;
  text-align: center;
}

.miniapp-modal__hero .eyebrow { color: rgba(242, 240, 234, 0.5); }

.miniapp-modal__icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
}

.miniapp-modal__name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0 0 10px;
}

.miniapp-modal__tagline {
  color: rgba(242, 240, 234, 0.6);
  font-size: 0.95rem;
  margin: 0 0 32px;
}

.miniapp-modal__screens {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 40px 40px 0;
  justify-content: safe center;
}

.miniapp-modal__screens img {
  height: 300px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.miniapp-modal__body {
  padding: 40px 48px 48px;
  font-size: 0.95rem;
  max-width: 620px;
  margin: 0 auto;
}

.miniapp-modal__body > :first-child { margin-top: 0; }
.miniapp-modal__body > :last-child { margin-bottom: 0; }

/* ===== Service Landing ===== */
.service-hero {
  background: var(--dark);
  color: var(--bg);
  padding: 110px 0 88px;
  text-align: center;
}

.hero-icon {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  margin-bottom: 28px;
}

.service-hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0 0 12px;
}

.hero-tagline {
  color: rgba(242, 240, 234, 0.6);
  font-size: 0.95rem;
  margin: 0 0 36px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.btn--primary {
  background: var(--bg);
  color: var(--ink);
}
.btn--primary:hover { opacity: 0.85; }

.btn--ghost {
  border: 1px solid rgba(242, 240, 234, 0.35);
  color: rgba(242, 240, 234, 0.75);
}
.btn--ghost:hover {
  border-color: var(--bg);
  color: var(--bg);
}

.service-screens {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 56px 24px;
  justify-content: safe center;
}

.service-screens img {
  height: 440px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px -20px rgba(27, 26, 24, 0.3);
}

.service-body { padding-top: 40px; max-width: 720px; }

/* ===== Privacy / Prose ===== */
.privacy { padding-top: 96px; max-width: 720px; }

.privacy-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.privacy-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  margin: 0 0 16px;
}

.privacy-app, .privacy-updated {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 4px 0;
}

.prose { font-size: 0.95rem; }

.prose h2 {
  font-family: var(--serif);
  font-weight: 600;
  margin-top: 2.4em;
  font-size: 1.35rem;
}

.prose h3 { margin-top: 1.6em; }
.prose li { margin-bottom: 6px; }
.prose a { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .keyboard { --kb-gap: 4px; padding: 12px 10px; border-radius: 12px; }
  .key { border-radius: 6px; }
  .key-icon { border-radius: 20%; }
  .home-hero { padding: 72px 0 48px; }
  .miniapps { padding-top: 64px; }
  .site-logo { padding: 16px 0; }

  /* 탭바 → 햄버거 메뉴 */
  .tabs { display: none; }
  .nav-toggle { display: flex; }

  /* Info: Experience/Award/Education 세로 배치 */
  .resume {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .resume-col .resume-title + .resume-list { margin-bottom: 40px; }
}
