/* ============================================================
   Haebin Kim — Resume / Portfolio
   Design tokens → base → layout → components
   ============================================================ */

:root {
  /* Dark theme is the DEFAULT */
  --accent: #5b8bff;
  --accent-strong: #7ba3ff;
  --accent-soft: rgba(91, 139, 255, 0.14);

  --bg: #0a0e1a;
  --bg-alt: #0e1424;
  --surface: #141d33;
  --surface-2: #1a2540;
  --border: #26324f;
  --text: #eaf0fb;
  --text-soft: #aeb9d1;
  --text-mute: #7683a0;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, 0.55);

  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1080px;
  --font: "Noto Sans KR", "Inter", system-ui, -apple-system, sans-serif;
  --font-en: "Inter", "Noto Sans KR", system-ui, sans-serif;
}

/* Explicit light theme (only when user opts in) */
:root[data-theme="light"] {
  --accent: #2f6bff;
  --accent-strong: #1b4fd8;
  --accent-soft: rgba(47, 107, 255, 0.1);
  --bg: #f6f8fc;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --border: #e3e8f2;
  --text: #14203a;
  --text-soft: #4b5972;
  --text-mute: #8b96ab;
  --shadow: 0 10px 30px -12px rgba(20, 32, 58, 0.18);
  --shadow-sm: 0 4px 14px -8px rgba(20, 32, 58, 0.22);
}

/* ------------------------- base ------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; border-radius: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ------------------------- floating theme toggle ------------------------- */
.theme-toggle.floating {
  position: fixed; top: 1.2rem; right: 1.2rem; z-index: 120;
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text-soft); cursor: pointer; transition: .2s; box-shadow: var(--shadow-sm);
}
.theme-toggle.floating:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* default (dark) shows moon; light theme shows sun */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ------------------------- hero ------------------------- */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  padding: clamp(4rem, 10vh, 7rem) 0 clamp(3rem, 6vh, 5rem);
  position: relative; overflow: hidden; text-align: center;
}
.hero-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 55% at 50% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(40% 40% at 85% 90%, rgba(123, 163, 255, 0.10), transparent 70%);
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; display: flex; flex-direction: column; align-items: center; }

.hero-eyebrow {
  font-family: var(--font-en); font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-size: .82rem; margin-bottom: .8rem;
}
.hero-title { font-size: clamp(2.6rem, 8vw, 4.4rem); font-weight: 900; display: flex; flex-direction: column; gap: .2rem; }
.hero-title .hero-en { font-family: var(--font-en); font-size: clamp(1rem, 3vw, 1.4rem); font-weight: 600; color: var(--text-mute); letter-spacing: .04em; }

.hero-role { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.2rem; }
.hero-role span {
  font-family: var(--font-en); font-size: .82rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.hero-lead { margin-top: 1.6rem; font-size: clamp(1rem, 2.4vw, 1.16rem); color: var(--text-soft); max-width: 640px; }
.hero-lead strong { color: var(--text); font-weight: 700; }
/* keep each sentence on its own line so wrapping never splits mid-phrase */
.hero-lead .nowrap { display: block; }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: clamp(1.2rem, 4vw, 2.6rem);
  list-style: none; margin: 2.4rem 0 0; padding: 1.6rem 0 0; border-top: 1px solid var(--border); width: 100%; max-width: 620px;
}
.hero-stats strong { display: block; font-family: var(--font-en); font-size: clamp(1.2rem, 3.5vw, 1.7rem); font-weight: 800; color: var(--accent); }
.hero-stats span { color: var(--text-mute); font-size: .82rem; }

.hero-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: 2.4rem; }

.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.4rem; margin-top: 1.8rem; }
.hero-links a { display: inline-flex; align-items: center; gap: .45rem; color: var(--text-mute); font-family: var(--font-en); font-size: .9rem; transition: color .2s; }
.hero-links a:hover { color: var(--accent); }

/* ------------------------- buttons ------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: .98rem;
  padding: .8rem 1.4rem; border-radius: 12px; border: 1px solid transparent; transition: .2s;
}
.btn-sm { padding: .55rem 1rem; font-size: .9rem; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-2px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ------------------------- section shell ------------------------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: 2.6rem; }
.section-kicker {
  font-family: var(--font-en); font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); font-size: .8rem;
}
.section-title { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 800; margin-top: .5rem; }

/* ------------------------- about ------------------------- */
.about-grid { display: grid; grid-template-columns: 300px 1fr; gap: 2rem; align-items: start; }

.about-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; text-align: center; box-shadow: var(--shadow-sm); position: sticky; top: 90px;
}
.about-photo {
  width: 128px; height: 128px; margin: 0 auto 1.1rem; border-radius: 50%;
  object-fit: cover; object-position: center 20%;
  box-shadow: 0 0 0 5px var(--accent-soft); border: 2px solid var(--surface);
}
.about-name { font-size: 1.4rem; font-weight: 800; }
.about-name span { display: block; font-family: var(--font-en); font-size: .95rem; color: var(--text-mute); font-weight: 500; }
.about-birth { color: var(--text-mute); font-size: .88rem; margin-top: .2rem; }
.about-bio { color: var(--text-soft); font-size: .94rem; margin-top: 1rem; text-align: left; }
.about-links { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.2rem; }
.chip {
  font-family: var(--font-en); font-size: .85rem; padding: .5rem .8rem; border-radius: 10px;
  background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); transition: .2s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

.about-timeline { display: flex; flex-direction: column; gap: 1.6rem; }
.tl-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem 1.8rem; box-shadow: var(--shadow-sm); }
.tl-heading { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.tl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.tl-list li { display: grid; grid-template-columns: 110px 1fr; gap: 1rem; }
.tl-date { font-family: var(--font-en); font-size: .84rem; font-weight: 600; color: var(--accent); padding-top: .1rem; }
.tl-list strong { font-weight: 700; }
.tl-list em { display: block; font-style: normal; color: var(--text-mute); font-size: .88rem; margin-top: .2rem; }
.tl-badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.tl-badges li {
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: .88rem;
  padding: .5rem .9rem; border-radius: 999px;
}

/* ------------------------- skills ------------------------- */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; box-shadow: var(--shadow-sm); transition: .25s; display: flex; flex-direction: column;
}
.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.skill-icon { font-size: 1.9rem; }
.skill-card h3 { font-size: 1.18rem; font-weight: 800; margin-top: .8rem; }
.skill-sub { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: .3rem; }
.skill-domains { list-style: none; margin: 1rem 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.skill-domains li { position: relative; padding-left: 1.2rem; color: var(--text-soft); font-size: .93rem; }
.skill-domains li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tags span {
  font-family: var(--font-en); font-size: .8rem; font-weight: 600; padding: .35rem .7rem;
  border-radius: 8px; background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border);
}

/* ------------------------- projects ------------------------- */
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(1.6rem, 4vw, 2.4rem); box-shadow: var(--shadow-sm); margin-bottom: 1.6rem; transition: .25s;
}
.project:hover { box-shadow: var(--shadow); }
.project-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; }
.project-no {
  font-family: var(--font-en); font-weight: 800; font-size: 1.6rem; color: var(--accent);
  background: var(--accent-soft); width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
}
.project-title { font-size: clamp(1.2rem, 3vw, 1.55rem); font-weight: 800; margin: 1.1rem 0 .8rem; }
.project-emoji { margin-right: .5rem; font-size: 1.1em; vertical-align: -0.05em; }
.project-desc { color: var(--text-soft); max-width: 68ch; }

.project-meta { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 1.4rem 0; padding: 1rem 1.2rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.project-meta div { display: flex; flex-direction: column; }
.project-meta dt { font-size: .78rem; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.project-meta dd { margin: .2rem 0 0; font-weight: 600; font-size: .95rem; }

.project-points { margin: 1.2rem 0; padding-left: 1.2rem; color: var(--text-soft); display: flex; flex-direction: column; gap: .4rem; }
.project-note { color: var(--text-mute); font-size: .86rem; margin-top: .8rem; }

.stats { list-style: none; margin: 1.4rem 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stats li { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem; text-align: center; }
.stats strong { display: block; font-family: var(--font-en); font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stats span { color: var(--text-mute); font-size: .84rem; }

.project-links { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.2rem; }

/* callout: 왜 만들었나 */
.project-callout {
  margin: 1.2rem 0; padding: 1.1rem 1.3rem; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft); font-size: .95rem;
}
.callout-label { display: block; color: var(--accent-strong); font-size: .8rem; font-weight: 700; letter-spacing: .04em; margin-bottom: .5rem; }
.project-callout strong { color: var(--text); font-weight: 700; }
.project-callout em { font-style: normal; color: var(--accent-strong); font-weight: 600; }
/* break lines only at sentence / comma boundaries */
.project-callout .nowrap { display: block; }

/* role grid: 담당 역할 4분면 */
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; margin: 1.4rem 0; }
.role-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.role-tag { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: .2rem .6rem; border-radius: 999px; margin-bottom: .5rem; }
.role-item p { color: var(--text-soft); font-size: .9rem; }
.role-item strong { color: var(--text); }

/* subhead + 단계별 개선 */
.project-subhead { font-size: 1rem; font-weight: 700; margin: 1.6rem 0 .8rem; }
.improve-steps { list-style: none; counter-reset: step; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.improve-steps li {
  counter-increment: step; position: relative; padding-left: 2.2rem;
  color: var(--text-soft); font-size: .92rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
}
.improve-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-en); font-size: .78rem; font-weight: 700; color: #fff; background: var(--accent);
}
.step-metric {
  font-family: var(--font-en); font-size: .8rem; font-weight: 700; color: var(--accent-strong);
  background: var(--accent-soft); padding: .12rem .5rem; border-radius: 6px; white-space: nowrap;
}

/* plan grid: 주요 기획 사항 (씨젠) */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin: 0 0 1rem; }
.plan-item {
  position: relative; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.6rem 1.1rem 1.1rem; margin-top: .9rem;
}
.plan-no {
  position: absolute; top: -.9rem; left: 1.1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-en); font-size: .82rem; font-weight: 700;
  color: #fff; background: var(--accent); box-shadow: var(--shadow-sm);
}
.plan-item p { color: var(--text-soft); font-size: .9rem; }
.plan-item strong { color: var(--text); }

/* agent pipeline flow (CSS-built, dark-mode native — no image) */
.agent-flow { list-style: none; counter-reset: node; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0; }
.agent-flow li {
  counter-increment: node; display: flex; align-items: flex-start; gap: .8rem;
  padding: .7rem 0 .7rem 0; flex-wrap: wrap;
}
/* connector line hangs off the node badge itself, so it stays centered
   even when a long flow-desc wraps and grows the <li>'s height */
.flow-node { position: relative; }
.agent-flow li:not(:last-child) .flow-node::after {
  content: ""; position: absolute; left: 1rem; top: 100%; height: 1.4rem;
  width: 2px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 25%, transparent));
}
.flow-node {
  display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0;
  font-family: var(--font-en); font-weight: 700; font-size: .88rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .9rem .4rem 2.1rem;
}
.flow-node::before {
  content: counter(node); position: absolute; left: .3rem; top: 50%; transform: translateY(-50%);
  width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: #fff; background: var(--accent);
}
.flow-desc { color: var(--text-soft); font-size: .9rem; }

/* inline code */
.project code, .role-item code, .improve-steps code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .85em;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .05rem .35rem; color: var(--accent-strong);
}

/* figures (architecture diagram + service screenshot) */
.project-figure { margin: 1.4rem 0 0; }
.project-figure img {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border);
  /* light source images sit in a soft white frame so they read in dark mode */
  background: #fff; padding: 10px;
}
.project-figure figcaption { margin-top: .7rem; color: var(--text-mute); font-size: .84rem; text-align: center; }

/* the phone-style screenshot is portrait & tall — keep it small and centered */
.project-figure-shot img { max-width: 340px; margin-inline: auto; padding: 0; }

/* collapsible "자세히 보기" section */
.project-more { margin-top: 1.4rem; border-top: 1px solid var(--border); padding-top: .4rem; }
.project-more > summary {
  cursor: pointer; list-style: none; padding: .9rem .2rem; font-weight: 700; font-size: .95rem;
  color: var(--accent-strong); display: flex; align-items: center; gap: .5rem; user-select: none;
}
.project-more > summary::-webkit-details-marker { display: none; }
.project-more > summary::before {
  content: "▸"; transition: transform .2s; display: inline-block; color: var(--accent);
}
.project-more[open] > summary::before { transform: rotate(90deg); }
.project-more > summary:hover { color: var(--accent); }
.project-more[open] > summary { margin-bottom: .4rem; }

/* ------------------------- other projects ------------------------- */
.other-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.other-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow-sm); transition: .25s; display: flex; flex-direction: column; gap: .8rem;
}
.other-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.other-card h3 { font-size: 1.1rem; font-weight: 800; }
.other-card p { color: var(--text-soft); font-size: .92rem; flex: 1; }
.other-card p strong { color: var(--text); font-weight: 700; }
.other-card .project-links { margin-top: 0; }
.card-award {
  display: inline-block; font-family: var(--font-en); font-size: .72rem; font-weight: 700;
  color: var(--accent-strong); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: .15rem .55rem; border-radius: 999px; margin-top: .4rem; letter-spacing: .01em; vertical-align: middle;
}

/* ------------------------- contact ------------------------- */
.contact-inner { text-align: center; max-width: 640px; }
.contact-lead { color: var(--text-soft); margin-top: .8rem; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 1.8rem; }

/* ------------------------- footer ------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; background: var(--bg-alt); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-inner p { color: var(--text-mute); font-size: .88rem; }
.to-top { color: var(--text-soft); font-weight: 600; font-size: .9rem; transition: color .2s; }
.to-top:hover { color: var(--accent); }

/* ------------------------- reveal animation ------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ------------------------- responsive ------------------------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-card { position: static; }
  .skill-grid, .other-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .skill-grid, .other-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .tl-list li { grid-template-columns: 84px 1fr; gap: .6rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.3rem 1rem; text-align: center; }
  .hero-nav .btn { flex: 1 1 40%; justify-content: center; }
  /* on narrow screens a full sentence may overflow — allow it to wrap naturally */
  .hero-lead .nowrap { display: inline; }
  .project-callout .nowrap { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
