/* =========================================================================
   Ivan Tuang — profile landing page
   Modern & bold resume theme.
   ========================================================================= */

:root {
  --accent:     #6d28d9;
  --accent-2:   #2563eb;
  --accent-mid: #4f46e5;
  --live:       #059669;
  --gradient:   linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

  --bg:         #f5f4ff;
  --bg-elev:    #ffffff;
  --bg-elev-2:  #eeedf8;
  --text:       #1a1530;
  --text-soft:  #64607e;
  --border:     #dddaf5;
  --shadow:     0 4px 24px rgba(109,40,217,0.07);
  --shadow-up:  0 8px 36px rgba(109,40,217,0.18);

  --maxw:   820px;
  --radius: 14px;
  --nav-h:  60px;
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0f0d1a;
    --bg-elev:  #18152a;
    --bg-elev-2:#221e36;
    --text:     #edeaf8;
    --text-soft:#9490b8;
    --border:   #403a6e;
    --shadow:   0 4px 24px rgba(0,0,0,0.4);
    --shadow-up:0 8px 36px rgba(0,0,0,0.55);
  }
}

/* --------------------------------- Reset --------------------------------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

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

/* ---------------------------------- Nav ---------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(245,244,255,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: box-shadow 0.3s;
}
@media (prefers-color-scheme: dark) {
  .nav { background: rgba(15,13,26,0.88); }
}
.nav.scrolled { box-shadow: 0 2px 16px rgba(109,40,217,0.1); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 1.5rem; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav__logo {
  font-weight: 900; font-size: 1.1rem;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav__links { display: flex; gap: 1.75rem; }
.nav__links a {
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-soft); transition: color 0.2s;
}
.nav__links a:hover { color: var(--accent); }
@media (max-width: 540px) { .nav__links { display: none; } }

/* --------------------------------- Hero ---------------------------------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 5rem;
  background: linear-gradient(145deg, #1a0a3a 0%, #0f1e5c 55%, #1e0a5a 100%);
  position: relative; overflow: hidden;
}
.hero::before, .hero::after {
  content: ''; position: absolute;
  border-radius: 50%; filter: blur(90px);
  opacity: 0.32; pointer-events: none;
}
.hero::before {
  width: 520px; height: 520px;
  background: var(--accent); top: -130px; left: -100px;
}
.hero::after {
  width: 420px; height: 420px;
  background: var(--accent-2); bottom: -90px; right: -70px;
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: 680px;
}
.hero__eyebrow {
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.45); margin-bottom: 0.75rem;
}
.hero__name {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 900; line-height: 1.0;
  letter-spacing: -0.035em; color: #fff;
  margin-bottom: 0.5rem;
}
.hero__tagline {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 600; margin-bottom: 1rem;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__current {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.88rem; color: rgba(255,255,255,0.7);
  margin-bottom: 2.25rem; flex-wrap: wrap; justify-content: center;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 100px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.badge--live {
  background: rgba(5,150,105,0.22);
  color: #34d399;
  border: 1px solid rgba(52,211,153,0.35);
}
.hero__cta {
  display: flex; gap: 0.875rem;
  justify-content: center; flex-wrap: wrap;
}
.hero__scroll {
  position: absolute; bottom: 2rem;
  left: 50%; transform: translateX(-50%); z-index: 1;
}
.hero__scroll span {
  display: block; width: 22px; height: 22px;
  border-right: 2.5px solid rgba(255,255,255,0.3);
  border-bottom: 2.5px solid rgba(255,255,255,0.3);
  transform: rotate(45deg);
  animation: bounceArr 1.7s ease-in-out infinite;
}
@keyframes bounceArr {
  0%,100% { transform: rotate(45deg) translate(0,0); opacity: 0.35; }
  50%      { transform: rotate(45deg) translate(5px,5px); opacity: 1; }
}

/* -------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.72rem 1.6rem;
  border-radius: 100px;
  font-size: 0.9rem; font-weight: 600;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  white-space: nowrap;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--gradient); color: #fff;
  box-shadow: 0 4px 18px rgba(109,40,217,0.35);
}
.btn--primary:hover { box-shadow: 0 6px 28px rgba(109,40,217,0.5); }

.btn--ghost {
  background: rgba(255,255,255,0.1); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.25);
}
.btn--ghost:hover { background: rgba(255,255,255,0.2); }

/* ghost on light backgrounds */
.section .btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.section .btn--ghost:hover { background: var(--bg-elev-2); }

/* ------------------------------- Sections -------------------------------- */
.section { padding: 5rem 1.5rem; }
.section:nth-child(even) { background: var(--bg-elev); }

.section__inner { max-width: var(--maxw); margin: 0 auto; }

.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 2rem;
  display: inline-block;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section__subtitle {
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-soft); text-transform: uppercase;
  letter-spacing: 0.1em; margin: 2.5rem 0 1rem;
}

/* -------------------------------- About ---------------------------------- */
.about__text {
  font-size: 1.05rem; line-height: 1.8;
  max-width: 680px; margin-bottom: 2rem;
}
.about__meta {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
}
.meta-item {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem; font-weight: 500;
  color: var(--text);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s;
}
.meta-item--static { cursor: default; }
a.meta-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  color: var(--accent);
}
.meta-text { line-height: 1; }
.meta-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.meta-icon svg { width: 16px; height: 16px; display: block; }

/* ------------------------------ Timeline --------------------------------- */
.timeline { position: relative; padding-left: 2.5rem; }
.timeline::before {
  content: ''; position: absolute;
  left: 7px; top: 4px; bottom: 4px; width: 3px;
  border-radius: 3px;
  background: linear-gradient(to bottom,
    transparent 0,
    var(--accent) 44px,
    var(--accent-2) calc(100% - 44px),
    transparent 100%);
}

.timeline__item { position: relative; padding-bottom: 2.5rem; }
.timeline__item:last-child { padding-bottom: 0; }

.timeline__marker {
  position: absolute; left: -2.5rem; top: 18px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
  z-index: 1;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.timeline__item:hover .timeline__marker {
  transform: scale(1.2);
  border-color: var(--accent-2);
}
.timeline__marker--current {
  background: var(--live); border-color: var(--live);
  animation: timelinePulse 2.2s ease-out infinite;
}
@keyframes timelinePulse {
  0%   { box-shadow: 0 0 0 4px var(--bg), 0 0 0 4px rgba(5,150,105,0.45); }
  70%  { box-shadow: 0 0 0 4px var(--bg), 0 0 0 13px rgba(5,150,105,0); }
  100% { box-shadow: 0 0 0 4px var(--bg), 0 0 0 4px rgba(5,150,105,0); }
}
@media (prefers-reduced-motion: reduce) {
  .timeline__marker--current { animation: none;
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(5,150,105,0.2); }
}

.timeline__body {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.timeline__item:hover .timeline__body {
  box-shadow: var(--shadow-up); transform: translateY(-2px);
}

.timeline__header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 0.6rem;
}
.timeline__role { font-size: 1rem; font-weight: 700; }
.timeline__company {
  font-size: 0.875rem; font-weight: 500;
  color: var(--accent-mid); margin-top: 0.1rem;
}
.timeline__date {
  font-size: 0.76rem; font-weight: 600; color: var(--text-soft);
  white-space: nowrap; padding: 0.2rem 0.65rem;
  background: var(--bg-elev-2); border-radius: 100px;
  align-self: flex-start;
}
.timeline__date--current {
  background: rgba(5,150,105,0.12); color: var(--live);
}
.timeline__desc {
  font-size: 0.88rem; line-height: 1.7;
  color: var(--text-soft); margin-bottom: 0.5rem;
}

.timeline__bullets {
  list-style: none; margin: 0 0 0.5rem;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.timeline__bullets li {
  font-size: 0.875rem; line-height: 1.65;
  color: var(--text-soft);
  padding-left: 1.2rem; position: relative;
}
.timeline__bullets li::before {
  content: '–'; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}

.timeline__mode {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  font-size: 0.68rem; font-weight: 600;
  border-radius: 4px;
  background: var(--bg-elev-2);
  color: var(--text-soft);
  vertical-align: middle;
  border: 1px solid var(--border);
}

.timeline__type {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.68rem; font-weight: 600;
  border-radius: 4px;
  background: rgba(109,40,217,0.1);
  color: var(--accent);
  border: 1px solid rgba(109,40,217,0.2);
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.timeline__project-groups {
  display: flex; flex-direction: column; gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.timeline__project-group { display: flex; flex-direction: column; gap: 0.5rem; }
.timeline__project-label {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}
.timeline__project-label::before {
  content: '';
  display: inline-block; width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--gradient);
}
.timeline__apps { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.app-link {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.22rem 0.7rem;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.74rem; font-weight: 500; color: var(--accent);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.app-link::before { content: '\2197'; font-size: 0.62rem; }
.app-link:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.app-tag {
  display: inline-flex; align-items: center;
  padding: 0.22rem 0.7rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 0.74rem; font-weight: 500; color: var(--text-soft);
}

/* -------------------------------- Skills --------------------------------- */
.skills__groups { display: flex; flex-direction: column; gap: 2rem; }

.skills__group-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-soft); margin-bottom: 0.75rem;
}
.skills__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.skill-tag {
  padding: 0.35rem 1rem;
  border-radius: 100px;
  font-size: 0.84rem; font-weight: 600;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  color: var(--text);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.skill-tag:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(109,40,217,0.12); }

.skill-tag--highlight {
  background: var(--gradient); color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(109,40,217,0.22);
}
.skill-tag--highlight:hover { box-shadow: 0 5px 20px rgba(109,40,217,0.4); }

/* ------------------------------ Education -------------------------------- */
.edu__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem; margin-bottom: 0;
}
.edu__card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.edu__card:hover { box-shadow: var(--shadow-up); transform: translateY(-2px); }
.edu__card--course { grid-column: 1 / -1; }

.edu__date {
  font-size: 0.76rem; font-weight: 600;
  color: var(--text-soft); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.4rem;
}
.edu__degree { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.edu__field {
  font-size: 0.875rem; font-weight: 500;
  color: var(--accent-mid); margin-bottom: 0.3rem;
}
.edu__school { font-size: 0.84rem; color: var(--text-soft); margin-bottom: 0.65rem; }
.edu__gpa {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--bg-elev-2); border-radius: 100px;
  font-size: 0.76rem; font-weight: 700; color: var(--accent);
}

/* ------------------------------ Contact ---------------------------------- */
.contact__inner { text-align: center; max-width: 560px; margin: 0 auto; }
.contact__text { font-size: 1.05rem; color: var(--text-soft); margin-bottom: 2rem; }
.contact__links { display: flex; gap: 0.875rem; justify-content: center; flex-wrap: wrap; }

/* ------------------------------- Footer ---------------------------------- */
.footer {
  padding: 1.5rem; text-align: center;
  font-size: 0.82rem; color: var(--text-soft);
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

/* ---------------------------- Scroll reveal ------------------------------ */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

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