/* =========================================================
   Portfolio styles
   ========================================================= */

:root {
  --bg: #f7f8fa;
  --bg-alt: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --text: #16181d;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --line: #e3e6eb;
  --accent: #0f6fff;
  --accent-2: #e8f0ff;
  --accent-text: #0a4fb8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(16, 24, 40, 0.45);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #14171c;
  --surface: #191c22;
  --surface-2: #20242b;
  --text: #eceef2;
  --text-2: #b4b9c3;
  --text-3: #8b919c;
  --line: #2a2f38;
  --accent: #4d8dff;
  --accent-2: #17263f;
  --accent-text: #8fb6ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 20px;
}

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

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { height: 100%; display: flex; align-items: center; gap: 16px; }
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.nav__brand img { border-radius: 8px; }
.nav__downloads { margin-left: auto; display: flex; gap: 8px; }
.nav__pdf-short { display: none; }
.nav__pdf {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav__pdf:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav__pdf-icon { font-size: 15px; line-height: 1; }
.nav__theme {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.nav__theme:hover { background: var(--surface-2); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(600px, calc(100vh - var(--nav-h)));
  display: flex; align-items: center;
  color: #fff;
}
.hero__bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(180deg, rgba(8, 12, 22, 0.55) 0%, rgba(8, 12, 22, 0.75) 60%, var(--bg) 100%),
    url("../images/main_bg.jpg");
  background-size: cover; background-position: center; background-repeat: no-repeat;
  transform: scale(1.02);
}
.hero__inner { position: relative; padding-block: 64px 72px; }
.hero__eyebrow {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75); margin-bottom: 18px;
}
.hero__title { font-size: clamp(38px, 7vw, 76px); font-weight: 800; letter-spacing: -0.03em; min-height: 1.2em; }
.hero__typing { border-bottom: 4px solid var(--accent); padding-bottom: 2px; }
.hero__cursor { font-weight: 300; margin-left: 4px; animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__name { margin-top: 26px; font-size: clamp(20px, 3vw, 28px); }
.hero__name strong { font-weight: 800; }
.hero__name span { color: rgba(255, 255, 255, 0.7); font-weight: 400; margin-left: 8px; }
.hero__tagline { margin-top: 14px; max-width: 720px; font-size: 17px; line-height: 1.7; color: rgba(255, 255, 255, 0.85); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 10px; font-weight: 700; font-size: 15px;
  border: 1px solid transparent; transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn--ghost { background: transparent; border-color: currentColor; }
.hero .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.hero .btn--ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn--sm { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ---------- Sections ---------- */
.section { padding-block: 88px; }
.section--alt { background: var(--bg-alt); }
.section__title {
  font-size: clamp(28px, 4vw, 36px); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 28px;
  display: flex; align-items: center; gap: 14px;
}
.section__title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section__title--gap { margin-top: 56px; }
.section__lead { color: var(--text-2); margin-bottom: 28px; max-width: 720px; }

/* ---------- About ---------- */
.about__intro { max-width: 860px; }
.about__intro p { color: var(--text-2); font-size: 16.5px; line-height: 1.8; }
.about__intro p + p { margin-top: 14px; }

.skills { display: grid; gap: 0; border-top: 1px solid var(--line); }
.skill {
  display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.skill__group { font-size: 14px; font-weight: 700; color: var(--text-2); }
.skill__subs { display: flex; flex-wrap: wrap; gap: 8px 0; }
.skill__sub + .skill__sub { margin-left: 18px; padding-left: 18px; border-left: 1px solid var(--line); }
.skill__sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.skill__sublabel { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-right: 2px; white-space: nowrap; }
.skill__sublabel::after { content: ":"; }
.skill__items { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); line-height: 1.4;
}
.tag--accent { background: var(--accent-2); color: var(--accent-text); border-color: transparent; }

/* ---------- Career timeline ---------- */
.timeline { list-style: none; position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline__item { position: relative; padding-bottom: 32px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: -28px; top: 8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg-alt); box-shadow: 0 0 0 2px var(--accent);
}
.career__total { font-size: 16px; font-weight: 600; color: var(--accent-text); margin: -8px 0 24px; letter-spacing: 0.02em; }
.timeline__period { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.timeline__duration { font-family: var(--font); color: var(--accent-text); font-weight: 600; }
.timeline__note { margin-top: 6px; font-size: 14px; color: var(--text-3); }
.timeline__block { margin-top: 18px; }
.timeline__label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.timeline__intro {
  padding: 16px 18px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 15px; line-height: 1.7;
}
.timeline__intro p + p { margin-top: 8px; }
.timeline__org { font-size: 20px; font-weight: 800; margin-top: 4px; }
.timeline__role { color: var(--accent-text); font-weight: 600; margin-top: 2px; }
.timeline__summary { color: var(--text-2); margin-top: 8px; max-width: 760px; }
.timeline__items { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; counter-reset: task; }
.timeline__items li {
  position: relative; padding: 12px 14px 12px 44px; color: var(--text); font-size: 15px; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); counter-increment: task;
}
.timeline__items li::before {
  content: counter(task, decimal-leading-zero); position: absolute; left: 14px; top: 13px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent-text); letter-spacing: 0.04em;
}

/* ---------- Filters ---------- */
.filters { display: grid; gap: 10px; margin-bottom: 18px; }
.filters__row { display: flex; align-items: flex-start; gap: 14px; }
.filters__label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); padding-top: 8px; min-width: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-2); transition: all 0.15s;
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip__count { opacity: 0.6; font-weight: 500; margin-left: 4px; font-size: 12.5px; }

/* ---------- Project stories ---------- */
.stories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.story {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; animation: rise 0.35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.story__head { display: flex; gap: 16px; padding: 22px 22px 20px; background: var(--surface-2); height: 100%; box-sizing: border-box; }
.story__foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 16px; }
.story__thumb { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.story__pages { margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,0.4); font-family: var(--mono); font-weight: 600; font-size: 12px; }
.modal__pos { font-family: var(--mono); font-size: 13px; color: var(--text-3); align-self: center; }
.modal__nav[hidden] { display: none; }
.story__more {
  margin-left: auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 700; white-space: nowrap; transition: filter 0.15s, transform 0.15s;
}
.story__more:hover, .story__more:focus-visible { filter: brightness(1.08); transform: translateY(-1px); outline: none; }
.story__index { font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; padding-top: 4px; min-width: 44px; }
.story__headbody { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.story__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; }
.story__org { font-weight: 700; color: var(--accent-text); }
.story__period { font-family: var(--mono); color: var(--text-3); }
.story__count { color: var(--text-3); }
.story__title { font-size: 19px; font-weight: 800; line-height: 1.35; margin-top: 6px; letter-spacing: -0.01em; }
.story__plain { margin-top: 10px; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.story__plain b, .detail__easy b {
  display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  background: var(--accent-2); color: var(--accent-text); vertical-align: 1px;
}
.projects__empty { padding: 40px; text-align: center; color: var(--text-3); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6, 8, 14, 0.62); backdrop-filter: blur(3px); animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal__dialog {
  position: relative; width: min(1040px, 100%); max-height: min(90vh, 960px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; outline: none;
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal__close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 22px; line-height: 1; z-index: 2;
}
.modal__close:hover { background: var(--surface-2); }
.modal__body { padding: 30px 30px 20px; overflow-y: auto; }
.modal__nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 30px 18px; border-top: 1px solid var(--line); background: var(--surface); }

.detail__story { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; padding-right: 40px; }
.detail__storylabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-2); padding: 2px 8px; border-radius: 6px; }
.detail__storypos { font-family: var(--mono); color: var(--text-3); }
.detail__easy { margin-top: 12px; color: var(--text); font-size: 15.5px; line-height: 1.7; }
.modal__navbtn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal__navshort { display: none; }
.detail__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; margin-bottom: 10px; padding-right: 40px; }
.detail__org { font-weight: 700; color: var(--accent-text); }
.detail__period { font-family: var(--mono); color: var(--text-3); }
.detail__title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; padding-right: 40px; }
.detail__summary { color: var(--text-2); margin-top: 12px; font-size: 15.5px; }
.detail__facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 14px; }
.detail__fact b { font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; color: var(--text-3); margin-right: 8px; }
.detail__desc {
  margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); font-size: 15px; line-height: 1.65;
}
.detail__desc p + p, .detail__desc ol + p, .detail__desc p + ol { margin-top: 10px; }
.detail__desc p:has(+ ol) { font-weight: 700; }
.detail__steps { list-style: none; display: grid; gap: 6px; counter-reset: step; }
.detail__steps li { position: relative; padding-left: 30px; counter-increment: step; }
.detail__steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.detail__gallery { display: grid; gap: 14px; }
.detail__figure { margin: 0; }
.detail__figure img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.detail__figure figcaption { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.detail__section { margin-top: 24px; }
.detail__label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.detail__list { list-style: none; display: grid; gap: 8px; }
.detail__list li { position: relative; padding-left: 18px; color: var(--text); font-size: 15px; }
.detail__list li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.detail__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail__links { display: flex; flex-wrap: wrap; gap: 8px; }
.detail__links a { font-weight: 700; color: var(--accent-text); padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.detail__links a:hover { background: var(--accent-2); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav__pdf { padding: 8px 10px; font-size: 13px; }
  .nav__pdf-text { display: none; }
  .nav__pdf-short { display: inline; }
  .nav__downloads { gap: 6px; }
  .skill__subs { flex-direction: column; align-items: stretch; gap: 8px; }
  .skill__sub + .skill__sub { margin-left: 0; padding-left: 0; border-left: 0; }
  .modal__navtext { display: none; }
  .modal__navshort { display: inline; }
  .modal__navbtn { max-width: none; }
  .detail__story { font-size: 12.5px; }
  .stories { grid-template-columns: 1fr; }
  .story__foot { flex-direction: column; align-items: stretch; }
  .story__thumb { width: 100%; max-width: none; aspect-ratio: 16 / 7; }
  .story__more { margin-left: 0; text-align: center; padding: 11px 14px; }
  .story__head { padding: 18px 18px 16px; gap: 12px; }
  .story__index { font-size: 22px; min-width: 32px; }
  .skill { grid-template-columns: 1fr; gap: 6px; align-items: start; }
  .timeline__items { grid-template-columns: 1fr; }
  .section { padding-block: 64px; }
  .hero__inner { padding-block: 48px 64px; }
  .modal { padding: 0; align-items: end; }
  .modal__dialog { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal__body, .modal__nav { padding-inline: 20px; }
}
@media (max-width: 480px) {
  .nav__brand span { display: none; }
  .filters__row { flex-direction: column; gap: 6px; }
  .filters__label { padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .story, .modal__backdrop, .modal__dialog { animation: none; }
  .hero__cursor { animation: none; }
}
