/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --ink: #111114;
  --ink-soft: #55565f;
  --ink-faint: #8a8b93;
  --line: #e8e8ee;
  --accent: #3454ff;
  --accent-ink: #ffffff;
  --accent-soft: #ecf0ff;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 20, 0.04);
  --shadow-md: 0 12px 32px -12px rgba(17, 17, 20, 0.16);
  --shadow-lg: 0 24px 60px -20px rgba(17, 17, 20, 0.22);
  --maxw: 1120px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

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

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

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}

section { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0);
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.nav.scrolled {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
  font-weight: 600;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-size: 0.85rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.nav-links a { transition: color 0.2s ease; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: #fff !important;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: transform 0.2s ease, background 0.2s ease;
}
.nav-cta:hover { background: var(--accent); transform: translateY(-1px); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 150px 0 80px;
  overflow: hidden;
}
.hero-inner {
  display: grid;
  gap: 28px;
  max-width: 780px;
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.04;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero-role {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 620px;
}
.hero-role strong { color: var(--ink); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}
.btn-ghost:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.hero-meta {
  display: flex;
  gap: 28px;
  margin-top: 20px;
  color: var(--ink-faint);
  font-size: 0.86rem;
}
.hero-meta span { display: flex; align-items: center; gap: 8px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #33c481;
  box-shadow: 0 0 0 4px rgba(51, 196, 129, 0.16);
}

/* Decorative background */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(560px 320px at 85% 0%, var(--accent-soft), transparent 65%),
    radial-gradient(400px 300px at 10% 30%, #fff7ed, transparent 60%);
  pointer-events: none;
}

/* ---------- Section headers ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.section-head p { color: var(--ink-soft); max-width: 380px; margin: 0; }

section.projects, section.contact {
  padding: 110px 0;
}
section.about {
  padding: 64px 0;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: start;
}
.about-text p {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.about-text p:last-child { margin-bottom: 0; }
.about-text strong { color: var(--ink); font-weight: 600; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.stat .num {
  font-family: "Fraunces", serif;
  font-size: 1.7rem;
  color: var(--accent);
}
.stat .label {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-top: 2px;
}

.skill-groups { display: grid; gap: 22px; }
.skill-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 24px;
}
.skill-group h3 {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 14px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.84rem;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: #d8dcf0;
}
.card-visual {
  height: 220px;
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card:hover .card-visual img { transform: scale(1.04); }

.card-visual.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.card-visual.split img { height: 100%; }
.card-visual.split .divider {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.6);
}

.card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(17,17,20,0.82);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.card-badge.gold { background: #b8860b; }

.card-body {
  padding: 28px 28px 30px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 6px;
}
.card-body h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.card-body p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0 0 20px;
  flex: 1;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.card-link svg { transition: transform 0.25s ease; }
.card:hover .card-link svg { transform: translate(3px, -3px); }

/* ECG svg visual */
.ecg-visual, .chart-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.ecg-visual svg, .chart-visual svg { width: 88%; height: auto; }

.ecg-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: draw 2.6s ease-out forwards infinite alternate;
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.chart-visual rect { transition: transform 0.4s ease; }

/* ---------- Contact / Footer ---------- */
section.contact { text-align: center; }
.contact h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 18px; }
.contact p {
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 auto 36px;
  font-size: 1.05rem;
}
.contact-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

footer {
  border-top: 1px solid var(--line);
  padding: 36px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--ink); }

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed;
  inset: 74px 0 0 0;
  background: #fff;
  z-index: 99;
  display: flex;
  flex-direction: column;
  padding: 20px 32px 40px;
  gap: 4px;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mobile-menu a {
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}
.mobile-menu .btn { margin-top: 20px; align-self: flex-start; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 120px 0 60px; }
  section.about { padding: 50px 0; }
  section.projects, section.contact { padding: 80px 0; }
}

@media (max-width: 520px) {
  .container { padding: 0 20px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}
