/* ==========================================================================
   신민재 Portfolio — main.css
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --border: #e6e8eb;
  --text: #14181f;
  --text-muted: #5b6270;
  --text-faint: #8a909c;
  --accent: #3462ff;
  --accent-strong: #1f47db;
  --accent-soft: #eaefff;
  --android: #3ddc84;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.04), 0 8px 24px rgba(20, 24, 31, 0.06);
  --shadow-lg: 0 12px 32px rgba(20, 24, 31, 0.10), 0 2px 8px rgba(20, 24, 31, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1040px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Noto Sans KR", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-alt: #12151c;
  --surface: #151922;
  --border: #232833;
  --text: #edf0f5;
  --text-muted: #a2a9b8;
  --text-faint: #6b7280;
  --accent: #6d8bff;
  --accent-strong: #8ba1ff;
  --accent-soft: rgba(109, 139, 255, 0.14);
  --android: #3ddc84;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --bg-alt: #12151c;
    --surface: #151922;
    --border: #232833;
    --text: #edf0f5;
    --text-muted: #a2a9b8;
    --text-faint: #6b7280;
    --accent: #6d8bff;
    --accent-strong: #8ba1ff;
    --accent-soft: rgba(109, 139, 255, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.section {
  padding: 96px 0;
  border-top: 1px solid var(--border);
}
.section--alt { background: var(--bg-alt); }
.section-head {
  margin-bottom: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.section-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 10px;
}
.section-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 480px;
}

/* ---------- Nav ---------- */
#topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
#topnav.scrolled { border-bottom-color: var(--border); }
#topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--android); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-links a.active { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }

#theme-toggle .sun { display: none; }
:root[data-theme="dark"] #theme-toggle .sun { display: block; }
:root[data-theme="dark"] #theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) #theme-toggle .moon { display: none; }
}

#menu-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
#hero {
  position: relative;
  padding: 168px 0 96px;
  overflow: hidden;
}
#hero::before {
  content: "";
  position: absolute;
  top: -220px; right: -180px;
  width: 620px; height: 620px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
#hero::after {
  content: "";
  position: absolute;
  bottom: -260px; left: -200px;
  width: 560px; height: 560px;
  background: radial-gradient(circle, color-mix(in srgb, var(--android) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; }
.hero-name {
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 16px 0 8px;
}
.hero-role {
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.hero-role strong { color: var(--text); font-weight: 700; }
.hero-desc {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 600px;
  margin-bottom: 32px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 14px;
  color: var(--text-muted);
}
.hero-meta a { display: inline-flex; align-items: center; gap: 7px; transition: color 0.15s ease; }
.hero-meta a:hover { color: var(--accent); }
.hero-meta svg { width: 15px; height: 15px; opacity: 0.85; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 56px;
}
.stat {
  background: var(--surface);
  padding: 22px 18px;
  text-align: left;
}
.stat b {
  display: block;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.stat span { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: start;
}
.about-copy p { color: var(--text-muted); font-size: 15.5px; margin-bottom: 16px; }
.about-copy strong { color: var(--text); }

.pillar-list { display: grid; gap: 14px; }
.pillar {
  display: flex;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pillar:hover { border-color: var(--accent); transform: translateY(-2px); }
.pillar-icon {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.pillar-icon svg { width: 19px; height: 19px; }
.pillar h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.pillar p { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }

/* ---------- Experience ---------- */
.timeline { position: relative; }
.tl-item {
  position: relative;
  padding-left: 32px;
  padding-bottom: 44px;
  border-left: 2px solid var(--border);
}
.tl-item:last-child { padding-bottom: 0; border-color: transparent; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -7px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.tl-item.is-current::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 6px; }
.tl-role { font-size: 18px; font-weight: 800; }
.tl-org { font-size: 14.5px; font-weight: 700; color: var(--accent); }
.tl-date {
  font-size: 12.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-left: auto;
}
.tl-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tl-body { color: var(--text-muted); font-size: 14.5px; }
.tl-body ul { display: grid; gap: 7px; margin-top: 10px; }
.tl-body li { position: relative; padding-left: 16px; }
.tl-body li::before {
  content: "";
  position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-faint);
}
.tl-sub { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.tl-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.skill-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 18px 20px;
}
.skill-card h4 {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.tag.primary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.project-thumb {
  aspect-ratio: 16/10;
  background: var(--bg-alt);
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-tag { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.project-body h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.005em; }
.project-body p { font-size: 13.5px; color: var(--text-muted); flex: 1; }
.project-link { font-size: 13px; font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.project-link svg { width: 13px; height: 13px; transition: transform 0.15s ease; }
.project-card:hover .project-link svg { transform: translateX(3px); }

/* ---------- Education / Awards ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.edu-block h4 { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 16px; }
.edu-entry { margin-bottom: 16px; }
.edu-entry .name { font-weight: 700; font-size: 15.5px; }
.edu-entry .meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.award-list { display: grid; gap: 12px; }
.award-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.award-item svg { width: 17px; height: 17px; color: var(--android); flex: none; margin-top: 2px; }
.award-item .name { font-weight: 700; font-size: 14px; }
.award-item .meta { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Contact / Footer ---------- */
#contact { text-align: center; }
.contact-inner { max-width: 560px; margin: 0 auto; }
.contact-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-faint);
}
footer .foot-links { display: flex; gap: 16px; }
footer a:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Back to top ---------- */
#to-top {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 90;
}
#to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#to-top svg { width: 17px; height: 17px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .edu-grid { grid-template-columns: 1fr; gap: 32px; }
  .skills-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .section { padding: 64px 0; }
  #hero { padding: 128px 0 64px; }
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    gap: 2px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-links a { padding: 12px; }
  #menu-toggle { display: inline-flex; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 18px; }
  .hero-actions .btn { flex: 1; justify-content: center; }
}

/* ==========================================================================
   Project detail page (project.html)
   ========================================================================== */

.pd-hero { padding: 140px 0 56px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 20px;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 15px; height: 15px; }

.pd-jump {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 28px;
}
.pd-jump a {
  font-size: 12.5px; font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.pd-jump a:hover { color: var(--accent); border-color: var(--accent); }

.pd-project { padding: 56px 0; border-top: 1px solid var(--border); }
.pd-project:first-of-type { border-top: none; }
.pd-grid { display: grid; grid-template-columns: 260px 1fr; gap: 44px; align-items: start; }

.pd-side { position: sticky; top: 88px; }
.pd-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.pd-title { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 16px; }
.pd-media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  aspect-ratio: 1/1;
  background: var(--bg-alt);
}
.pd-media img { width: 100%; height: 100%; object-fit: cover; }
.pd-chips { display: flex; flex-wrap: wrap; gap: 7px; }

.pd-body { font-size: 15px; color: var(--text-muted); }
.pd-body p { margin-bottom: 14px; }
.pd-body h4 {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text); margin: 26px 0 12px;
}
.pd-body h4:first-child { margin-top: 0; }
.pd-body ul { display: grid; gap: 8px; margin-bottom: 16px; }
.pd-body ul li { position: relative; padding-left: 18px; }
.pd-body ul li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint);
}
.pd-body ol { padding-left: 20px; display: grid; gap: 6px; margin-bottom: 16px; }
.pd-body ol li { padding-left: 4px; }
.pd-note {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  margin-bottom: 16px;
}
.pd-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.pd-embed {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0 16px;
}
.pd-diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0 16px;
  overflow: hidden;
}

@media (max-width: 780px) {
  .pd-grid { grid-template-columns: 1fr; }
  .pd-side { position: static; }
  .pd-media { aspect-ratio: 16/10; }
}
