/* ===== CSS 변수 ===== */
:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --border: #e5e7eb;
  --ring: rgba(37, 99, 235, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #60a5fa;
    --primary-contrast: #0b1220;
    --border: #1f2937;
    --ring: rgba(96, 165, 250, 0.5);
  }
}
/* 수동 토글을 위한 강제 다크 테마 */
:root[data-theme="dark"] {
  --bg: #0b1220;
  --card: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --primary-contrast: #0b1220;
  --border: #1f2937;
  --ring: rgba(96, 165, 250, 0.5);
}

/* ===== Reset & 기본 타이포 ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, Segoe UI, Roboto, Noto Sans KR, Apple SD Gothic Neo, "Malgun Gothic", Arial, sans-serif;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }

a { color: var(--primary); text-decoration: none; }
a:focus, button:focus { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ===== 레이아웃 ===== */
.container { width: min(100%, 1040px); margin: 0 auto; padding: 0 20px; }
header.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(120%) blur(8px);
  background: color-mix(in oklab, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--border); overflow: hidden; }
.brand h1 { font-size: 18px; margin: 0; }
nav ul { display: flex; gap: 16px; list-style: none; padding: 0; margin: 0; }
nav a { padding: 8px 10px; border-radius: 10px; }
nav a:hover { background: color-mix(in oklab, var(--primary) 12%, transparent); }

.hero { padding: 56px 0 28px; }
.hero h2 { font-size: clamp(28px, 3vw + 8px, 40px); margin: 6px 0 10px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 8px 0 0; }

.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .cols-2 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 1px 0 rgba(0,0,0,0.03); }
.card h3 { margin-top: 0; font-size: 20px; }

section.section { margin: 36px 0; }
.section h2 { font-size: 22px; margin: 0 0 14px; }

/* 소개 카드 */
.intro { display: grid; gap: 14px; }
.intro .meta { color: var(--muted); font-size: 15px; }

/* 연혁 (타임라인) */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-left: 40px; margin: 12px 0; }
.timeline li::marker { content: ""; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 25%, transparent); }
.timeline time { font-weight: 600; margin-right: 6px; }

/* 프로젝트 그리드 + 카드 */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project { display: grid; grid-template-rows: auto 1fr; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.project:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }

.thumb-wrap { aspect-ratio: 16 / 9; background: #eef2ff; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.thumb {
  width: 100%;
  height: 100%;
  object-fit: contain; /* 이미지 전체 표시 */
  object-position: center;
  background-color: #fff; /* 여백이 생길 경우 배경색 */
}


.project-body { padding-top: 12px; }
.project h4 { margin: 0 0 8px; font-size: 18px; }

/* 배지 */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: color-mix(in oklab, var(--card) 92%, var(--primary)); }
.badge.link { border-style: dashed; }

/* 액션 버튼(작게) */
.actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }

/* 연락처 */
.contact a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; }
.contact a:hover { background: color-mix(in oklab, var(--primary) 10%, transparent); }

/* 푸터 */
footer { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 0 48px; }

/* 유틸리티 */
.btn { appearance: none; border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 12px; border-radius: 12px; cursor: pointer; }
.btn:hover { background: color-mix(in oklab, var(--primary) 10%, var(--card)); }

/* 맨 위로 버튼 */
.to-top { position: fixed; right: 16px; bottom: 16px; padding: 10px 12px; border-radius: 999px; box-shadow: 0 4px 16px rgba(0,0,0,.15); display: none; }

/* 접근성: 스킵 링크 */
.visually-hidden-focusable {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.visually-hidden-focusable:focus {
  position: static; width: auto; height: auto; padding: 8px 12px; background: var(--card); border: 2px dashed var(--primary); border-radius: 10px;
}

/* 프린트 최소화 */
@media print {
  header.site-header, .to-top { display: none !important; }
  .card { box-shadow: none; }
  a { text-decoration: underline; }
}
