
    /* ===== CSS Variables (Light/Dark) ===== */
    :root {
      --bg: #f7f8fb;
      --text: #0f172a;
      --muted: #64748b;
      --primary: #2563eb;
      --primary-contrast: #ffffff;
      --card: #ffffff;
      --border: #e5e7eb;
      --shadow: 0 10px 25px rgba(2, 6, 23, .08);
      --radius: 16px;
      --container: 1120px;
    }
    :root.dark {
      --bg: #0b1220;
      --text: #e5e7eb;
      --muted: #9ca3af;
      --primary: #60a5fa;
      --primary-contrast: #0b1220;
      --card: #0f172a;
      --border: #1f2937;
      --shadow: 0 10px 25px rgba(15, 23, 42, .6);
    }

    /* ===== Global ===== */
    *, *::before, *::after { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0; background: var(--bg); color: var(--text);
      font: 400 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Noto Sans KR, Apple SD Gothic Neo, Ubuntu, Cantarell, 'Helvetica Neue', Arial, "Apple Color Emoji","Segoe UI Emoji";
    }
    a { color: inherit; text-decoration: none; }
    img { max-width: 100%; height: auto; }
    .container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
    .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
    .btn {
      display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--border);
      background: var(--card); color: var(--text); font-weight: 600; transition: transform .05s ease, opacity .2s ease, background .2s ease;
    }
    .btn:hover { transform: translateY(-1px); }
    .btn.primary { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
    .btn.icon { padding: 10px 12px; border-radius: 12px; }
    .chip { display:inline-block; padding:6px 10px; border-radius: 999px; border:1px solid var(--border); color:var(--muted); font-size: 13px; background: color-mix(in oklab, var(--card) 90%, var(--primary) 10%); }
    .muted { color: var(--muted); }
    .section { padding: 80px 0; }
    .section h2 { font-size: 28px; margin: 0 0 14px; }
    .section p.lead { margin: 0 0 30px; color: var(--muted); }
    .grid { display: grid; gap: 18px; }

    /* ===== Header / Nav ===== */
    .skip { position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden; }
    .skip:focus { position: fixed; left: 16px; top: 16px; width: auto; height: auto; padding: 10px 14px; background: var(--primary); color: var(--primary-contrast); border-radius: 8px; z-index: 9999; }

    header.navbar {
      position: sticky; top: 0; z-index: 100; background: color-mix(in oklab, var(--bg) 70%, var(--card) 30%);
      border-bottom: 1px solid var(--border); backdrop-filter: saturate(140%) blur(6px);
    }
    .nav-inner { display:flex; align-items:center; justify-content:space-between; padding: 14px 0; }
    .brand { display:flex; align-items:center; gap:12px; font-weight:800; letter-spacing: .3px; }
    .brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); box-shadow: var(--shadow); display:grid; place-items:center; color: var(--primary-contrast); font-weight:800; }
    nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; }
    nav a:hover, nav a:focus { color: var(--text); background: color-mix(in oklab, var(--card) 70%, var(--primary) 30%); }

    /* Theme toggle */
    .theme-toggle { border:1px solid var(--border); background: var(--card); }

    /* ===== Hero ===== */
    .hero { display:grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: center; }
    .hero .title { font-size: 42px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.6px; }
    .hero .subtitle { margin: 0 0 24px; color: var(--muted); }
    .avatar {
      width: 180px; height: 180px; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow);
      background: repeating-linear-gradient(45deg, color-mix(in oklab, var(--card) 70%, var(--primary) 30%), color-mix(in oklab, var(--card) 70%, var(--primary) 30%) 10px, var(--card) 10px, var(--card) 20px);
      display:grid; place-items:center; color: var(--muted); font-weight:700;
    }
    .hero-actions { display:flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

    /* ===== Skills ===== */
    .skills { grid-template-columns: repeat(4, 1fr); }
    .skill-card { padding: 18px; }
    .skill-card h3 { margin: 0 0 10px; font-size: 16px; }
    .skill-list { display:flex; flex-wrap:wrap; gap:8px; }

    /* ===== Projects ===== */
    .projects { grid-template-columns: repeat(3, 1fr); }
    .project { display:flex; flex-direction:column; overflow:hidden; }
    .project .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 28%, var(--card) 72%), var(--card)); border-bottom: 1px solid var(--border); display:grid; place-items:center; color: var(--muted); font-weight:700; }
    .project .body { padding: 16px; display:flex; flex-direction:column; gap:10px; }
    .project .title { font-weight:700; }
    .project .tags { display:flex; flex-wrap:wrap; gap:6px; }
    .project .actions { margin-top:auto; display:flex; gap:10px; }

    /* ===== Timeline (Experience/Education) ===== */
    .timeline { position: relative; padding-left: 22px; }
    .timeline::before { content:""; position:absolute; left:7px; top: 0; bottom: 0; width:2px; background: var(--border); }
    .tl-item { position:relative; padding: 12px 0 12px 14px; }
    .tl-item::before { content:""; position:absolute; left:-2px; top: 18px; width:10px; height:10px; border:2px solid var(--primary); background: var(--card); border-radius:50%; }
    .tl-item h3 { margin: 0; font-size: 16px; }
    .tl-item .meta { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }

    /* ===== Contact ===== */
    form.contact { display:grid; gap: 12px; max-width: 680px; }
    .input { width:100%; padding:12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
    textarea.input { min-height: 140px; resize: vertical; }

    /* ===== Footer ===== */
    footer { padding: 30px 0 60px; color: var(--muted); text-align:center; }

    /* ===== Responsive ===== */
    @media (max-width: 980px) {
      .hero { grid-template-columns: 1fr; }
      .skills { grid-template-columns: repeat(2, 1fr); }
      .projects { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 640px) {
      .skills, .projects { grid-template-columns: 1fr; }
      .hero .title { font-size: 34px; }
    }

    /* ===== Print (for PDF export) ===== */
    @media print {
      header, .hero-actions, nav, .theme-toggle, .project .actions, footer { display:none !important; }
      .section { padding: 24px 0; }
      .card { box-shadow:none; }
      body { background: #fff; }
    }
    /* 공통 헤더 정리 */
.navbar { position: sticky; top: 0; z-index: 50; background: var(--bg); }
.nav-inner { display:flex; align-items:center; gap:12px; }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; }
.nav { display:flex; align-items:center; gap:14px; }

/* 모바일: 햄버거 노출 + 메뉴 접기 */
.menu-toggle { display:none; }

/* ≤ 768px 레이아웃 */
@media (max-width: 768px){
  .nav-inner { gap:8px; }
  .brand { flex:1 1 auto; min-width:0; }
  .menu-toggle { display:inline-flex; }

  /* 드롭다운 패널 */
  .nav{
    position: absolute;
    left:0; right:0; top:100%;
    display:block;
    background: var(--bg);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform-origin: top center;
    transform: scaleY(0);
    opacity:0; pointer-events:none;
    transition: transform .18s ease, opacity .18s ease;
  }
  .nav a, .nav .theme-toggle{
    display:block; width:100%; text-align:left;
    padding:12px 16px;
  }
  .nav.open{
    transform: scaleY(1);
    opacity:1; pointer-events:auto;
  }
}

/* 데스크톱에서 항목이 넘치지 않게 */
@media (min-width: 769px){
  .nav { margin-left:auto; }
}

/* === 모바일 헤더 개선: 가로 스크롤 탭, 햄버거 사용 안함 === */
@media (max-width: 768px){
  /* 헤더 좌우 간격/정렬 */
  .nav-inner{ gap:10px; padding:12px 0; }

  /* 브랜드는 줄바꿈 없이, 공간 과점유 방지 */
  .brand{ flex:0 0 auto; min-width:0; }
  /* " · Portfolio" 텍스트가 길면 줄이거나 숨김 */
  .brand span:last-child{
    max-width:140px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }

  /* 메뉴는 가로 스크롤로 */
  header.navbar nav{
    flex:1 1 auto; min-width:0;
    display:flex; align-items:center; gap:8px;
    overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  header.navbar nav::-webkit-scrollbar{ display:none; }

  /* 탭 크기 살짝 축소 */
  header.navbar nav a{ padding:8px 10px; white-space:nowrap; }

  /* 테마 토글은 맨 오른쪽으로 밀기 */
  header.navbar .theme-toggle{ margin-left:auto; }

  /* 햄버거/드롭다운 비활성화 (있어도 숨김) */
  .menu-toggle{ display:none !important; }
  .nav.open{ transform:none; opacity:1; pointer-events:auto; }
}

/* 데스크톱에서 메뉴는 기존처럼 오른쪽 정렬 */
@media (min-width: 769px){
  header.navbar nav{ margin-left:auto; }
}
/* ===== Mobile header polish (≤768px) ===== */
@media (max-width: 768px){
  header.navbar{
    padding-top: env(safe-area-inset-top); /* iOS notch 대비 */
    background: color-mix(in oklab, var(--bg) 80%, var(--card) 20%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(140%) blur(6px);
  }

  /* 2줄 레이아웃: 1행 = 브랜드 + 토글, 2행 = 탭 */
  .nav-inner{
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    row-gap: 8px;
    padding: 10px 0 0;
  }

  /* 브랜드는 줄바꿈/넘침 방지 */
  .brand{ min-width:0; gap:10px; font-weight:700; }
  .brand span:last-child{
    max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .brand .logo{ width:28px; height:28px; border-radius:10px; } /* 살짝 축소 */

  /* 테마 토글은 우측 정렬 */
  .theme-toggle{ grid-column: 2; justify-self: end; }

  /* 메뉴 탭: 가로 스크롤, 좌우 페이드(마스크) */
  header.navbar nav{
    grid-column: 1 / -1; grid-row: 2;
    display: flex; gap: 10px;
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    padding: 8px 0 10px;
    margin: 0 -20px;           /* 컨테이너 패딩과 시각적으로 이어지게 */
    padding-left: 20px; padding-right: 20px;
    border-top: 1px solid var(--border);
    scrollbar-width: none;
    /* 좌우 페이드로 스크롤 힌트 */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
  header.navbar nav::-webkit-scrollbar{ display:none; }

  /* 탭 크기/간격 조정 */
  header.navbar nav a{
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
  }

  /* 햄버거/드롭다운 UI는 완전히 비활성화 */
  .menu-toggle{ display: none !important; }
  .nav.open{ transform:none; opacity:1; pointer-events:auto; }
}

/* 데스크톱 유지 */
@media (min-width: 769px){
  header.navbar nav{ margin-left:auto; }
}
/* 공통 여백 변수 */
:root { --gutter: 20px; }

/* container 여백도 변수로 통일 */
.container { padding-inline: var(--gutter); }

/* ===== Mobile header fix (≤768px) ===== */
@media (max-width: 768px){
  /* 노치/안전영역 고려한 헤더 패딩 */
  header.navbar{
    padding-top: env(safe-area-inset-top);
  }

  /* 1행(브랜드)이 좌우에 정확히 여백을 갖도록 강제 */
  header.navbar .container{
    padding-left:  calc(var(--gutter) + env(safe-area-inset-left));
    padding-right: calc(var(--gutter) + env(safe-area-inset-right));
  }

  /* 2행(nav)은 풀-블리드 효과를 유지하되 동일 기준으로 계산 */
  header.navbar nav{
    margin-left:  calc(-1 * var(--gutter));
    margin-right: calc(-1 * var(--gutter));
    padding-left:  calc(var(--gutter) + env(safe-area-inset-left));
    padding-right: calc(var(--gutter) + env(safe-area-inset-right));
  }

  /* (선택) 로고가 너무 커 보이면 살짝 축소 */
  .brand .logo{ width:28px; height:28px; border-radius:10px; }
}

    