/* =========================================================
   ZHIJUN — Portfolio
   Light & clean theme. Mobile-first, responsive.
   ========================================================= */

:root {
  --bg: #fbfbfd;
  --bg-soft: #f3f4f8;
  --surface: #ffffff;
  --ink: #0e1116;
  --ink-soft: #4a505b;
  --ink-faint: #8a909c;
  --line: #e6e8ee;
  --accent: #4f46e5;       /* indigo */
  --accent-soft: #eef0ff;
  --accent-ink: #3b34c4;
  --grad-a: #4f46e5;
  --grad-b: #06b6d4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(14, 17, 22, .04), 0 2px 8px rgba(14, 17, 22, .05);
  --shadow-md: 0 8px 30px rgba(14, 17, 22, .08);
  --shadow-lg: 0 24px 60px rgba(14, 17, 22, .12);
  --maxw: 1120px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
button { font: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.section { padding-block: clamp(64px, 10vw, 128px); }

.section__eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -.02em;
}
.section__sub {
  margin-top: 16px;
  color: var(--ink-soft);
  max-width: 56ch;
  font-size: 1.05rem;
}
.section__head { margin-bottom: 48px; max-width: 760px; }
.muted { color: var(--ink-faint); font-weight: 500; }
.grad {
  background: linear-gradient(100deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  padding: 13px 22px;
  border-radius: 999px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .2s var(--ease);
  will-change: transform;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, .28);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(79, 70, 229, .38); }
.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.btn--block { width: 100%; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: rgba(251, 251, 253, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
}
.nav.is-scrolled { border-color: var(--line); box-shadow: var(--shadow-sm); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -.01em;
}
.nav__brand .dot { color: var(--accent); }
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__link {
  font-weight: 500;
  font-size: .96rem;
  color: var(--ink-soft);
  position: relative;
  transition: color .2s var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width .25s var(--ease);
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover::after, .nav__link.is-active::after { width: 100%; }
.nav__link.is-active { color: var(--ink); }
.nav__cta {
  background: var(--accent);
  color: #fff !important;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
}
.nav__cta::after { display: none; }
.nav__cta:hover { transform: translateY(-1px); }
.nav__toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav__toggle span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s var(--ease); }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: 150px; padding-bottom: clamp(60px, 9vw, 120px); overflow: hidden; }
.hero__inner { position: relative; z-index: 2; max-width: 880px; }
.hero__eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.06;
  letter-spacing: -.03em;
}
.hero__lede {
  margin-top: 24px;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 62ch;
}
.hero__actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 14px; }
.hero__stats {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.stat__num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  letter-spacing: -.02em;
  color: var(--ink);
}
.stat__label { font-size: .85rem; color: var(--ink-faint); }
.hero__glow {
  position: absolute;
  top: -180px; right: -160px;
  width: 620px; height: 620px;
  background: radial-gradient(circle at center, rgba(79,70,229,.18), rgba(6,182,212,.10) 45%, transparent 70%);
  filter: blur(20px);
  z-index: 1;
  pointer-events: none;
}

/* ---------- About ---------- */
.about__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: start; }
.about__text p { color: var(--ink-soft); margin-top: 18px; font-size: 1.05rem; }
.about__text .section__title { margin-bottom: 6px; }
.about__panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 96px;
}
.about__panel-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 18px;
}
.about__skills li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.about__skills li:first-of-type { border-top: none; }
.about__skills span { font-weight: 600; }
.about__skills em { font-style: normal; color: var(--ink-faint); font-size: .9rem; text-align: right; }

/* ---------- Timeline ---------- */
.timeline { position: relative; margin-left: 8px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--line));
}
.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding-left: 36px;
  padding-bottom: 36px;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 16px; height: 16px;
  background: var(--surface);
  border: 3px solid var(--accent);
  border-radius: 50%;
  z-index: 1;
  transition: transform .25s var(--ease);
}
.timeline__item:hover::before { transform: scale(1.2); }
.timeline__date { font-family: var(--font-display); font-weight: 600; color: var(--ink-faint); font-size: .92rem; }
.timeline__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.timeline__card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #d6d9e4; }
.timeline__card h3 { font-family: var(--font-display); font-size: 1.18rem; margin-bottom: 8px; }
.timeline__card p { color: var(--ink-soft); }

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags li {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 999px;
}

/* ---------- Projects grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s var(--ease);
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: #d6d9e4; }
.card__thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--bg-soft), #e8eaf2);
  position: relative;
  overflow: hidden;
}
.card__thumb::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(79,70,229,.18), transparent 55%),
              radial-gradient(circle at 75% 80%, rgba(6,182,212,.18), transparent 55%);
  transition: transform .6s var(--ease);
}
.card:hover .card__thumb::before { transform: scale(1.15) rotate(4deg); }
.card__thumb::after {
  content: attr(data-label);
  position: absolute;
  left: 18px; bottom: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  color: rgba(14,17,22,.10);
  letter-spacing: -.02em;
}
.card__body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card__body h3 { font-family: var(--font-display); font-size: 1.18rem; margin-bottom: 8px; }
.card__body p { color: var(--ink-soft); font-size: .98rem; }
.card__link {
  margin-top: auto;
  padding-top: 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .92rem;
  color: var(--accent);
  transition: gap .2s var(--ease), color .2s var(--ease);
}
.card__link:hover { color: var(--accent-ink); }

/* ---------- Contact ---------- */
.contact { background: var(--bg-soft); border-top: 1px solid var(--line); }
.contact__inner { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact__email {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent);
  border-bottom: 2px solid transparent;
  transition: border-color .2s var(--ease);
}
.contact__email:hover { border-color: var(--accent); }
.contact__meta { margin-top: 12px; color: var(--ink-faint); font-size: .95rem; }
.contact__form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow-md);
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 7px;
  color: var(--ink);
}
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 110px; }
.form__note { margin-top: 14px; font-size: .9rem; min-height: 1.2em; }
.form__note.is-error { color: #c2362f; }
.form__note.is-ok { color: #1f9254; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #c8ccd6; padding-block: 40px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer .nav__brand { color: #fff; }
.footer__social { display: flex; gap: 22px; }
.footer__social a { color: #c8ccd6; font-size: .95rem; transition: color .2s var(--ease); }
.footer__social a:hover { color: #fff; }
.footer__copy { font-size: .88rem; color: #8b909d; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about__grid { grid-template-columns: 1fr; gap: 36px; }
  .about__panel { position: static; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .contact__inner { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 720px) {
  .nav__links {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    padding: 8px 24px 20px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .3s var(--ease), opacity .3s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__link { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav__link::after { display: none; }
  .nav__cta { text-align: center; margin-top: 12px; }
  .nav__toggle { display: flex; }

  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: 22px 16px; }
  .timeline__item { grid-template-columns: 1fr; gap: 10px; }
  .timeline__date { font-size: .82rem; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .container { padding-inline: 18px; }
  .hero__actions .btn { width: 100%; }
}
