@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #F9F8F6;
  --surface: #FFFFFF;
  --border: #E8E6E1;
  --text: #111010;
  --muted: #6B6860;
  --accent: #1B4FD8;
  --accent-light: #EEF2FF;
  --tag-bg: #F0EEE9;
  --nav-h: 64px;
  --max-w: 1100px;
  --px: clamp(24px, 6vw, 80px);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: pageLoad 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes pageLoad {
  from { opacity: 0; }
  to { opacity: 1; }
}

html[data-theme] body, html[data-theme] nav, html[data-theme] .project-card, html[data-theme] .exp-card, html[data-theme] .ach-card, html[data-theme] .contact-form-wrap, html[data-theme] .nav-mobile, html[data-theme] .freelance-banner {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}



.back-to-top {
  position: fixed; bottom: 30px; right: 30px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--text); color: var(--bg);
  border: none; font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 99; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-to-top.visible {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.back-to-top:hover {
  transform: translateY(-3px); background: var(--accent);
}

main { flex: 1; }

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--px);
  transition: box-shadow 0.3s ease, padding 0.3s ease;
}

nav.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}
.nav-logo {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; gap: 8px; list-style: none; align-items: center; }
.nav-links a {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  position: relative;
  background: transparent !important;
}
.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 2px;
  left: 50%;
  background-color: var(--accent);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(-50%);
  border-radius: 2px;
}
.nav-links a:hover::after,
.nav-links a.active::after {
  width: 70%;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); font-weight: 600; }
a.nav-cta {
  background: var(--accent) !important;
  color: #FFFFFF !important;
  padding: 8px 18px !important;
}
a.nav-cta::after {
  display: none !important;
}
a.nav-cta:hover { background: var(--text) !important; color: #FFFFFF !important; transform: translateY(-1px); }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none;
  cursor: pointer; padding: 4px;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all 0.3s;
}
.nav-mobile {
  display: none;
  position: fixed; top: var(--nav-h); left: 0; right: 0;
  height: auto;
  align-items: stretch;
  justify-content: flex-start;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 16px var(--px);
  flex-direction: column; gap: 8px;
  z-index: 999;
}
.nav-mobile a {
  text-decoration: none; font-size: 0.95rem; font-weight: 500;
  color: var(--text); padding: 10px 12px; border-radius: 8px;
  transition: background 0.2s;
}
.nav-mobile a:hover { background: var(--tag-bg); }
.nav-mobile a.active { color: var(--accent); }
.nav-mobile.open { display: flex; }

/* ── PAGE WRAPPER ── */
.page-wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 64px) var(--px) 80px;
}

/* ── SECTION LABEL & TITLE ── */
.section-label {
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.section-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600; line-height: 1.15;
  letter-spacing: -0.03em; margin-bottom: 48px;
}
.section-title.sm {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 32px;
}

.divider { width: 100%; height: 1px; background: var(--border); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; font-size: 0.875rem; font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  border-radius: 6px; text-decoration: none;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); cursor: pointer; border: none;
}
.btn-primary { background: var(--text); color: var(--bg); position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -150%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-20deg); animation: shimmer 4s infinite;
}
@keyframes shimmer { 0% { left: -150%; } 20%, 100% { left: 200%; } }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 20px rgba(27, 79, 216, 0.25); }
.btn-outline { border: 1.5px solid var(--border); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05); }
.btn-sm { padding: 8px 18px; font-size: 0.82rem; }

/* ── TAGS ── */
.tech-tag {
  font-size: 0.75rem; font-weight: 500;
  padding: 4px 10px; border-radius: 100px;
  background: var(--tag-bg); color: var(--muted);
  border: 1px solid var(--border);
}
.skill-pill {
  font-size: 0.8rem; font-weight: 500;
  padding: 5px 12px; border-radius: 100px;
  background: var(--tag-bg); color: var(--text);
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px var(--px);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
  font-size: 0.82rem; color: var(--muted);
  background: var(--surface);
}
footer a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--text); }
.footer-links { display: flex; gap: 24px; }

/* ── ANIMATIONS ── */
@keyframes floatGentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}
.floating-element {
  animation: floatGentle 6s ease-in-out infinite;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { opacity: 0; animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) forwards; }
.d1 { animation-delay: 0.08s; }
.d2 { animation-delay: 0.18s; }
.d3 { animation-delay: 0.30s; }
.d4 { animation-delay: 0.42s; }
.d5 { animation-delay: 0.54s; }
.d6 { animation-delay: 0.66s; }
.d7 { animation-delay: 0.78s; }

.mask-line { display: inline-block; overflow: hidden; vertical-align: bottom; }
.mask-inner {
  display: inline-block;
  transform: translateY(100%);
  animation: slideUpMask 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes slideUpMask { to { transform: translateY(0); } }

[data-reveal] {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
[data-reveal].visible { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* ── DARK THEME ── */
html[data-theme="dark"] {
  --bg: #111010;
  --surface: #1C1B1B;
  --border: #333130;
  --text: #F9F8F6;
  --muted: #A8A6A0;
  --accent: #5C82F2;
  --accent-light: rgba(92, 130, 242, 0.15);
  --tag-bg: #2B2A29;
}

html[data-theme="dark"] nav {
  background: rgba(28, 27, 27, 0.85);
}

html[data-theme="dark"] .nav-mobile {
  background: var(--surface);
}

html[data-theme="dark"] a.nav-cta {
  color: var(--bg) !important;
}
html[data-theme="dark"] a.nav-cta:hover {
  color: var(--bg) !important;
}
