:root {
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --surface: #f8fafc;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --primary: #0052ff;
  --primary-ink: #0045d8;
  --primary-soft: #eff6ff;
  --hero-glow: rgba(0, 82, 255, 0.08);
  --shadow-sm: 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 20px 42px -18px rgba(15, 23, 42, 0.22);
  --radius: 1rem;
  --radius-xl: 1.5rem;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-glass: rgba(11, 17, 32, 0.88);
  --surface: #111827;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.1);
  --primary: #3b82f6;
  --primary-ink: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --hero-glow: rgba(59, 130, 246, 0.14);
  --shadow-sm: 0 10px 28px -12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 48px -18px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 66rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

@media (min-width: 640px) {
  .container {
    padding-inline: 2rem;
  }
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Subtle Interactive Animations */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes pulse-soft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.anim-gear {
  animation: spin-slow 10s linear infinite;
  transform-origin: center;
}

.anim-float {
  animation: float-y 3.5s ease-in-out infinite;
}

.anim-pulse {
  animation: pulse-soft 2.5s ease-in-out infinite;
}

/* Sticky Topbar */
#top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

#top-bar[data-scrolled] {
  border-bottom-color: var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.55rem;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-dot {
  color: var(--primary);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.15rem;
  border-radius: 0.7rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-outline {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm-hide {
  display: none;
}

@media (min-width: 640px) {
  .btn-sm-hide {
    display: inline-flex;
  }
}

/* Hero Section */
.hero {
  padding-block: 3.5rem 5rem;
}

@media (min-width: 768px) {
  .hero {
    padding-block: 5rem 6rem;
  }
}

.hero-grid {
  display: grid;
  align-items: center;
  gap: 3rem;
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 4rem;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.eyebrow::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: #10b981;
  flex-shrink: 0;
}

.hero-title {
  font-size: clamp(2.25rem, 4.8vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
}

.text-accent {
  color: var(--primary-ink);
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 34rem;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.hero-actions .btn {
  padding: 0.8rem 1.35rem;
  font-size: 0.95rem;
}

.hero-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Portrait Frame (jipraks.com clean 4:5 card + single overlap badge) */
.portrait-wrap {
  position: relative;
  max-width: 23rem;
  width: 100%;
  margin-inline: auto;
}

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 4.6;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 35%, var(--hero-glow) 0%, var(--surface) 75%);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.portrait-img {
  width: 94%;
  height: 94%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.16));
  transition: transform 0.35s ease;
}

.portrait-frame:hover .portrait-img {
  transform: scale(1.03);
}

.overlap-badge {
  position: absolute;
  bottom: -1.15rem;
  right: -0.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.15rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

@media (min-width: 640px) {
  .overlap-badge {
    right: -1.25rem;
  }
}

.overlap-badge:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.overlap-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
  background: var(--primary);
  color: #ffffff;
  flex-shrink: 0;
}

.overlap-val {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
}

.overlap-lbl {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

/* Sections */
.section {
  border-top: 1px solid var(--line);
  padding-block: 4.5rem;
}

.section-surface {
  background: var(--surface);
}

.section-head {
  margin-bottom: 2.5rem;
  max-width: 38rem;
}

.section-title {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--muted);
  font-size: 1rem;
}

/* 3-Column Clean Expertise Grid */
.expertise-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .expertise-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  padding: 1.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card-accent {
  background: var(--primary);
  color: #ffffff;
  border-color: transparent;
}

.card-accent:hover {
  border-color: transparent;
}

.card-accent .card-desc {
  color: rgba(255, 255, 255, 0.86);
}

.card-accent .tag {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
}

.card-accent .card-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card-desc {
  font-size: 0.92rem;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* Achievements Leaderboard (Clean jipraks.com rows) */
.split-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-num {
  font-size: clamp(2.75rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary-ink);
}

.kpi-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.25rem;
}

.list-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}

.list-row {
  display: grid;
  gap: 0.4rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background-color 0.15s ease;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:hover {
  background: var(--primary-soft);
}

@media (min-width: 640px) {
  .list-row {
    grid-template-columns: 4rem 1fr auto;
    gap: 1.25rem;
  }
}

.list-row.is-hidden {
  display: none;
}

.row-year {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary-ink);
}

.row-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.row-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  width: fit-content;
}

.pill-highlight {
  background: var(--primary-soft);
  color: var(--primary-ink);
  border-color: transparent;
}

.toggle-wrap {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
}

/* Timeline Section (Clean jipraks.com #about layout) */
.timeline-layout {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .timeline-layout {
    grid-template-columns: 0.85fr 1.15fr;
    gap: 4rem;
  }
}

.edu-box {
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.timeline {
  list-style: none;
  border-left: 2px solid var(--line);
  padding-left: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -2.22rem;
  top: 0.35rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: var(--muted);
  border: 3px solid var(--bg);
}

.timeline-item.current .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-ink);
  margin-bottom: 0.15rem;
}

.timeline-role {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Certifications Compact Strip */
.cert-wrap {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.cert-heading {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 1rem;
}

.cert-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cert-pill {
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0.42rem 0.8rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.cert-pill:hover {
  border-color: var(--primary);
  color: var(--primary-ink);
}

.cert-pill span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

/* Dark Contact Card (jipraks.com #collab style) */
.contact-section {
  padding-block: 1rem 4.5rem;
}

.contact-card {
  border-radius: var(--radius-xl);
  background: var(--ink);
  color: var(--bg);
  padding: 2.5rem 1.75rem;
  display: grid;
  gap: 2rem;
  align-items: center;
}

[data-theme="dark"] .contact-card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

@media (min-width: 768px) {
  .contact-card {
    grid-template-columns: 1.35fr 0.65fr;
    padding: 3.5rem 3rem;
  }
}

.contact-card h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.contact-card p {
  opacity: 0.8;
  font-size: 0.98rem;
  max-width: 34rem;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-card .btn-outline {
  background: transparent;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .contact-card .btn-outline {
  border-color: var(--line);
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.socials {
  display: flex;
  gap: 0.5rem;
}

/* Modal Dialog */
dialog.modal {
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--bg);
  color: var(--ink);
  padding: 1.75rem;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-top: 0.75rem;
}

.modal-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.modal-val {
  font-size: 0.92rem;
  font-weight: 700;
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile-First Executive Polish (< 640px) */
@media (max-width: 639px) {
  .nav-inner {
    height: 3.75rem;
    gap: 0.5rem;
  }

  .brand {
    font-size: 0.96rem;
    gap: 0.4rem;
  }

  .brand-icon {
    width: 1.7rem;
    height: 1.7rem;
  }

  .icon-btn {
    width: 2.05rem;
    height: 2.05rem;
  }

  .hero {
    padding-block: 2rem 3.5rem;
  }

  .hero-grid {
    gap: 2.25rem;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.12;
  }

  .hero-desc {
    font-size: 0.96rem;
    margin-bottom: 1.4rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .hero-actions .btn {
    width: 100%;
    padding: 0.78rem 0.75rem;
    font-size: 0.88rem;
  }

  .portrait-wrap {
    max-width: 20rem;
    margin-bottom: 0.75rem;
  }

  .overlap-badge {
    left: 0.85rem;
    right: 0.85rem;
    bottom: -1.15rem;
    padding: 0.8rem 1rem;
  }

  .section {
    padding-block: 3.25rem;
  }

  .section-head {
    margin-bottom: 1.75rem;
  }

  .card {
    padding: 1.35rem;
  }

  .list-row {
    padding: 0.95rem 1rem;
  }

  .contact-card {
    padding: 2rem 1.35rem;
  }

  .contact-actions .btn {
    width: 100%;
    padding: 0.85rem 1rem;
  }
}
