/* ===== 1. 공통 디자인 변수: 기본 화면은 밝은 테마 ===== */
:root {
  color-scheme: light;
  --background: #f8fafc;
  --surface: #eef3f8;
  --card: #ffffff;
  --text: #18243a;
  --muted: #53647b;
  --accent: #215bd5;
  --accent-hover: #1749b5;
  --accent-soft: #e5edff;
  --border: #dbe3ef;
  --header-bg: rgba(248, 250, 252, .95);
  --shadow: 0 14px 35px rgba(26, 46, 79, .08);
  --error: #b3261e;
  --success: #0b6b47;
}
/* data-theme는 JavaScript가 html에 붙이는 상태값입니다. */
[data-theme="dark"] {
  color-scheme: dark;
  --background: #0e1625;
  --surface: #151f31;
  --card: #1b2940;
  --text: #eff5ff;
  --muted: #acbad0;
  --accent: #84afff;
  --accent-hover: #aecaff;
  --accent-soft: #283f66;
  --border: #35465e;
  --header-bg: rgba(14, 22, 37, .96);
  --shadow: 0 14px 35px rgba(0, 0, 0, .28);
  --error: #ffaaa4;
  --success: #89e1ba;
}
/* ===== 2. 모바일 퍼스트: 가장 좁은 화면을 기준으로 설계 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 85px; }
body { margin: 0; min-width: 320px; background: var(--background); color: var(--text); font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; line-height: 1.65; transition: background-color .25s, color .25s; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.container { width: min(calc(100% - 36px), 1120px); margin-inline: auto; }
.section { padding: 80px 0; }
.section-muted { background: var(--surface); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.35rem, 7vw, 4.65rem); letter-spacing: -.055em; line-height: 1.23; }
h2 { font-size: clamp(1.85rem, 4.7vw, 3rem); letter-spacing: -.04em; line-height: 1.33; }
h3 { font-size: 1.1rem; }
.skip-link { position: absolute; top: -80px; left: 12px; padding: 8px 14px; background: var(--card); z-index: 50; }
.skip-link:focus { top: 10px; }
.section-kicker { font-size: .78rem; font-weight: 800; color: var(--accent); letter-spacing: .17em; margin-bottom: 14px; }
.section-description { max-width: 650px; color: var(--muted); line-height: 1.9; }
.section-intro { margin-bottom: 35px; }
/* ===== 3. 상단 메뉴: Flexbox로 로고/메뉴/버튼의 위치를 설정 ===== */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--background); border-bottom: 1px solid var(--border); transition: background-color .25s, box-shadow .25s; }
.site-header.scrolled { background: var(--header-bg); box-shadow: 0 9px 26px rgba(11, 28, 60, .11); backdrop-filter: blur(10px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; }
.logo { flex-shrink: 0; font-size: .93rem; letter-spacing: -.02em; font-weight: 800; text-decoration: none; }
.logo span { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; border-radius: 12px; padding: 8px 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.icon-button:hover { border-color: var(--accent); }
.theme-label { font-size: .85rem; }
.menu-toggle { width: 43px; }
.hamburger-lines { display: grid; gap: 4px; }
.hamburger-lines span { display: block; width: 19px; height: 2px; border-radius: 10px; background: currentColor; transition: transform .2s, opacity .2s; }
.menu-toggle.active .hamburger-lines span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.active .hamburger-lines span:nth-child(2) { opacity: 0; }
.menu-toggle.active .hamburger-lines span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
/* 모바일에서는 메뉴를 숨기고, active 클래스가 생겼을 때만 펼칩니다. */
.site-nav { position: absolute; top: 75px; left: 0; right: 0; padding: 0 18px; background: var(--card); border-bottom: 1px solid var(--border); visibility: hidden; opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .2s, transform .2s, visibility .2s; }
.site-nav.active { visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
.nav-links { display: flex; flex-direction: column; gap: 0; list-style: none; margin: 0 auto; max-width: 1120px; padding: 12px 0 16px; }
.nav-links a { display: block; padding: 11px 8px; border-radius: 8px; color: var(--muted); font-weight: 650; text-decoration: none; transition: color .2s, background-color .2s; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); background: var(--accent-soft); }
/* ===== 4. Hero / About ===== */
.hero { overflow: hidden; background: radial-gradient(circle at 85% 15%, var(--accent-soft), transparent 46%), var(--background); padding: 78px 0 26px; }
.hero-layout { display: grid; align-items: center; gap: 25px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); margin-bottom: 23px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #24aa82; box-shadow: 0 0 0 5px rgba(36, 170, 130, .12); }
.highlight { color: var(--accent); }
.hero-description { max-width: 580px; color: var(--muted); font-size: 1rem; line-height: 1.9; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 19px; min-height: 47px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--background); font-size: .92rem; font-weight: 750; text-decoration: none; transition: transform .2s, background-color .2s, box-shadow .2s; }
.button:hover { transform: translateY(-2px); background: var(--accent-hover); box-shadow: 0 8px 18px rgba(30, 83, 190, .15); }
.button-secondary { color: var(--accent); background: transparent; }
.button-secondary:hover { background: var(--accent-soft); }
.hero-art { position: relative; height: 275px; display: grid; place-items: center; isolation: isolate; }
.art-orbit { position: absolute; border: 1px solid var(--border); border-radius: 50%; width: 270px; height: 270px; }
.art-orbit-two { width: 220px; height: 220px; transform: rotate(50deg) skew(18deg); }
.art-card { display: flex; flex-direction: column; justify-content: space-between; width: 212px; height: 196px; padding: 23px; border: 1px solid var(--border); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); transform: rotate(-7deg); }
.art-card-label { font-weight: 750; font-size: .64rem; color: var(--muted); letter-spacing: .2em; }
.art-symbol { align-self: center; font-size: 2.4rem; font-weight: 800; letter-spacing: -.1em; color: var(--accent); }
.art-card-caption { color: var(--muted); font-size: .7rem; }
.hero-footnote { display: flex; justify-content: space-between; gap: 20px; margin-top: 36px; color: var(--muted); font-size: .76rem; }
.about-layout { display: grid; align-items: center; gap: 36px; }
.about-photo-wrap { max-width: 340px; padding: 17px; border-radius: 30px; background: var(--accent-soft); }
.profile-image { display: block; width: 100%; height: auto; border-radius: 20px; }
.about-note { font-size: .81rem; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; margin-top: 25px; }
/* ===== 5. 카드 목록: Grid + auto-fit/minmax = 화면 폭에 따라 열 수가 자동 변경 ===== */
.skills-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 16px; list-style: none; padding: 0; margin: 0; }
.skills-list li { display: flex; flex-direction: column; min-height: 160px; padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); transition: transform .2s; }
.skills-list li:hover { transform: translateY(-4px); }
.skills-list li span:last-child { color: var(--muted); font-size: .82rem; margin-top: 5px; }
.skill-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.section-heading-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.section-heading-row .section-description { margin-bottom: 0; }
.text-link { align-self: flex-start; color: var(--accent); font-weight: 750; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); gap: 18px; min-height: 144px; }
.project-card { display: flex; flex-direction: column; min-height: 195px; padding: 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; transition: transform .22s, box-shadow .22s, border-color .22s; overflow-wrap: anywhere; }
.project-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 17px 37px rgba(26, 46, 79, .14); }
.project-card h3 { margin: 4px 0 8px; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card h3 a:hover { color: var(--accent); text-decoration: underline; }
.project-card p { flex: 1; color: var(--muted); font-size: .89rem; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--accent); font-size: .78rem; font-weight: 750; }
.project-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .75rem; }
.state-panel { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; min-height: 168px; padding: 28px 18px; text-align: center; border: 1px dashed var(--border); border-radius: 16px; background: var(--card); color: var(--muted); }
.state-panel p { margin: 0; }
.state-panel .button { margin-top: 4px; }
.spinner { width: 25px; height: 25px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ===== 6. 문의 폼과 입력 오류 표시 ===== */
.contact-layout { display: grid; gap: 30px; }
.contact-form { padding: 24px 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.form-field { margin-bottom: 17px; }
.form-field label { display: block; font-size: .86rem; font-weight: 750; margin-bottom: 7px; }
.form-field label span { color: var(--error); }
.form-field input, .form-field textarea { display: block; width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; background: var(--background); color: var(--text); transition: border-color .2s; }
.form-field textarea { resize: vertical; min-height: 115px; }
.form-field input[aria-invalid="true"], .form-field textarea[aria-invalid="true"] { border-color: var(--error); }
.field-error { min-height: 0; margin: 4px 0 0; color: var(--error); font-size: .77rem; }
.field-error:empty { margin: 0; }
.form-status { margin: 12px 0 0; font-size: .85rem; font-weight: 650; }
.form-status.error { color: var(--error); }
.form-status.success { color: var(--success); }
.submit-button { width: 100%; }
.site-footer { padding: 26px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--muted); }
.footer-inner p { margin-bottom: 0; }
.footer-inner a { color: var(--accent); font-weight: 750; }
.back-to-top { position: fixed; right: 18px; bottom: 18px; z-index: 20; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--accent); border-radius: 50%; background: var(--accent); color: var(--background); font-size: 1.35rem; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(12px); pointer-events: none; transition: opacity .2s, visibility .2s, transform .2s; }
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
/* 애니메이션 대상은 JS가 동작할 때만 감춥니다. */
.js-reveal { opacity: 0; transform: translateY(24px); transition: opacity .65s ease, transform .65s ease; }
.js-reveal.visible { opacity: 1; transform: translateY(0); }
/* ===== 7. 태블릿: PDF에서 요구하는 768px 구간 ===== */
@media (min-width: 768px) {
  .container { width: min(calc(100% - 64px), 1120px); }
  .site-nav { position: static; padding: 0; background: transparent; border: 0; visibility: visible; opacity: 1; transform: none; pointer-events: auto; margin-left: auto; }
  .nav-links { flex-direction: row; align-items: center; gap: 2px; padding: 0; }
  .nav-links a { padding: 8px 10px; font-size: .85rem; }
  .menu-toggle { display: none; }
  .header-actions { margin-left: 0; }
  .hero-layout { grid-template-columns: 1.3fr .7fr; gap: 12px; }
  .hero-art { height: 350px; }
  .art-orbit { width: 320px; height: 320px; }
  .art-orbit-two { width: 260px; height: 260px; }
  .art-card { width: 245px; height: 245px; }
  .about-layout { grid-template-columns: minmax(210px, .78fr) 1.22fr; gap: 60px; }
  .section-heading-row { flex-direction: row; align-items: end; justify-content: space-between; }
  .contact-layout { grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: start; }
  .contact-form { padding: 28px; }
}
/* ===== 8. 데스크톱: PDF에서 요구하는 1024px 구간 ===== */
@media (min-width: 1024px) {
  .section { padding: 110px 0; }
  .hero { padding-top: 116px; padding-bottom: 35px; }
  .hero-art { height: 420px; }
  .art-orbit { width: 390px; height: 390px; }
  .art-orbit-two { width: 315px; height: 315px; }
  .art-card { width: 290px; height: 260px; }
  .nav-links a { padding-inline: 15px; }
  .hero-footnote { margin-top: 55px; }
}
/* 시스템 접근성 설정에 따라 불필요한 움직임을 줄입니다. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js-reveal { opacity: 1; transform: none; }
}