:root {
  --font-sans: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --max: 1180px;
  --nav-h: 72px;
  --radius: 18px;
  --trans: 220ms ease;
}

/* =========================================================
   Design (Theme) tokens — dark (default) & light
   ========================================================= */

/* Dark theme (default) */
:root,
:root[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-alt:     #1e293b;
  --bg-card:    #182233;
  --text:       #e2e8f0;
  --text-dim:   #94a3b8;
  --text-mute:  #64748b;
  --accent:     #64ffda;
  --accent-dim: #1e4d4a;
  --accent-txt: #0f172a;   /* text on top of accent-colored bg */
  --border:     #334155;
  --shadow:     0 10px 30px -15px rgba(2, 12, 27, .7);
  --nav-bg:     rgba(15, 23, 42, .8);
  color-scheme: dark;
}

/* Light theme */
:root[data-theme="light"] {
  --bg:         #f8fafc;
  --bg-alt:     #f1f5f9;
  --bg-card:    #ffffff;
  --text:       #0f172a;
  --text-dim:   #475569;
  --text-mute:  #64748b;
  --accent:     #0d9488;
  --accent-dim: #ccfbf1;
  --accent-txt: #ffffff;
  --border:     #e2e8f0;
  --shadow:     0 10px 30px -15px rgba(15, 23, 42, .15);
  --nav-bg:     rgba(248, 250, 252, .85);
  color-scheme: light;
}

/* Smooth transition between themes */
body, .nav, .about-card, .skill-group, .project, .btn, .timeline-content {
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}

/* =========================================================
   Theme button
   ========================================================= */
/* Theme toggle button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  transition: all var(--trans);
  margin-left: 1rem;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.theme-toggle .icon-moon { display: none; }

/* When dark theme active, show sun icon (to switch to light) */
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Adjust spacing for mobile */
@media (max-width: 700px) {
  .theme-toggle { margin-left: auto; margin-right: .75rem; }
}

/* =========================================================
   Reset & base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--trans); }
a:hover { opacity: .75; }

img { max-width: 100%; display: block; }
ul { list-style: none; }

::selection { background: var(--accent); color: var(--bg); }

/* =========================================================
   Nav
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.nav.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 10px 30px -10px rgba(2, 12, 27, .5);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: .2rem .55rem;
  line-height: 1;
}
.logo:hover { background: var(--accent-dim); opacity: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  color: var(--text-dim);
  font-size: .875rem;
  font-weight: 500;
  font-family: var(--font-mono);
  transition: color var(--trans);
}
.nav-links a:hover { color: var(--accent); opacity: 1; }
.nav-links .num { color: var(--accent); margin-right: .25rem; }

.nav-cta {
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  border-radius: 6px;
  padding: .5rem 1rem;
  font-size: .8rem !important;
}
.nav-cta:hover { background: var(--accent-dim); }

/* Mobile menu button */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: .5rem;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--accent);
  transition: transform var(--trans), opacity var(--trans);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 2rem;
}
.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding: 3rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  align-items: center;
  gap: 2rem;
}
.hero-text { max-width: 720px; }
.hero-photo {
  display: flex;
  justify-content: center;
  align-items: center;
}
.photo-frame {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(100, 255, 218, 0.6);
  background: linear-gradient(135deg, rgba(100,255,218,.2), rgba(148,163,184,.08));
  box-shadow: 0 0 0 1px rgba(100, 255, 218, 0.2), 0 18px 35px -22px rgba(16, 185, 129, 0.55);
  overflow: hidden;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.photo-frame:hover {
  transform: translateY(-4px);
  border-color: rgba(100, 255, 218, 0.9);
  box-shadow: 0 0 0 1px rgba(100, 255, 218, 0.35), 0 24px 42px -22px rgba(16, 185, 129, 0.7);
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 1.25rem;
  opacity: 0;
  animation: fadeUp .6s .1s forwards;
}
.hero h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: .25rem;
  opacity: 0;
  animation: fadeUp .6s .2s forwards;
}
.hero h2 {
  font-size: clamp(1.5rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--text-mute);
  line-height: 1.1;
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: fadeUp .6s .3s forwards;
}
.hero-desc {
  max-width: 580px;
  color: var(--text-dim);
  font-size: 1.0625rem;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp .6s .4s forwards;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp .6s .5s forwards;
}

.hero-scroll {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  color: var(--text-mute);
  animation: bounce 2s infinite;
}
.hero-scroll:hover { color: var(--accent); opacity: 1; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
  border: 1px solid var(--accent);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--accent); opacity: 1; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-dim); opacity: 1; }

/* =========================================================
   Sections
   ========================================================= */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 600;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
}
.section-title span {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 400;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 400px;
}
.section-title.center { justify-content: center; }
.section-title.center::after { display: none; }

/* =========================================================
   About
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 3rem;
  align-items: start;
}
.about-text p { color: var(--text-dim); margin-bottom: 1rem; }
.about-text strong { color: var(--text); font-weight: 600; }
.about-list {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4rem 1.5rem;
  font-size: .9rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.about-list li::before {
  content: '▸';
  color: var(--accent);
  margin-right: .6rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.about-card h3 {
  font-size: 1rem;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.about-card li {
  display: flex;
  gap: .75rem;
  padding: .5rem 0;
  font-size: .9rem;
  color: var(--text-dim);
}
.about-card .icon { flex-shrink: 0; }

/* =========================================================
   Skills
   ========================================================= */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform var(--trans), border-color var(--trans);
}
.skill-group:hover { transform: translateY(-3px); border-color: var(--accent); }
.skill-group h3 {
  font-size: .9rem;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 1rem;
  font-weight: 500;
}
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags span {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .78rem;
  font-family: var(--font-mono);
}
.tags.small span { font-size: .72rem; padding: .22rem .55rem; }

/* =========================================================
   Projects
   ========================================================= */
.filters {
  display: flex;
  gap: .5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.filter {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: .5rem 1rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: .8rem;
  cursor: pointer;
  transition: all var(--trans);
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.project {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--trans), border-color var(--trans), box-shadow var(--trans);
}
.project:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project.hidden { display: none; }

.project-head { margin-bottom: .75rem; }
.project-head h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.project-role {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-mute);
}
.project p {
  color: var(--text-dim);
  font-size: .92rem;
  margin-bottom: 1rem;
  flex: 1;
}
.project-link {
  font-family: var(--font-mono);
  font-size: .82rem;
  margin-top: 1rem;
  display: inline-block;
  align-self: flex-start;
}

/* =========================================================
   Timeline
   ========================================================= */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -2rem; top: 6px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline-content h3 {
  font-size: 1.1rem;
  margin-bottom: .25rem;
}
.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color var(--trans), transform var(--trans);
}
.timeline-content:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}
.timeline-meta {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--text-mute);
  margin-bottom: .75rem;
}
.timeline-content p {
  color: var(--text-dim);
  font-size: .95rem;
}

/* =========================================================
   Experience — two-column layout
   ========================================================= */
.experience-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.experience-heading {
  font-size: .85rem;
  font-family: var(--font-mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.timeline-head h4 {
  font-size: 1.05rem;
  font-weight: 600;
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-mute);
  white-space: nowrap;
}
.timeline-content .tags { margin-top: .75rem; }

.coursework {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem 1rem;
  margin-top: .75rem;
  font-size: .88rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.coursework li::before {
  content: '▸';
  color: var(--accent);
  margin-right: .5rem;
}

@media (max-width: 820px) {
  .experience-layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .coursework { grid-template-columns: 1fr; }
}

/* =========================================================
   Contact
   ========================================================= */
.contact { text-align: center; padding-bottom: 7rem; }
.contact-desc {
  max-width: 540px;
  margin: 0 auto 2.25rem;
  color: var(--text-dim);
}
.contact-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-mute);
}
.footer-sub { margin-top: .4rem; opacity: .6; font-size: .72rem; }

/* =========================================================
   Animations
   ========================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, -8px); }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
  .photo-frame { width: min(100%, 300px); }
}

@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .about-list { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .nav-inner { padding: 0 1.25rem; }
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-h); right: 0;
    width: min(75vw, 320px);
    height: calc(100vh - var(--nav-h));
    background: var(--bg-alt);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 3rem 2rem;
    gap: 1.75rem;
    transform: translateX(100%);
    transition: transform var(--trans);
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a { font-size: 1rem; }

  .hero { padding: 1rem; }
  .section { padding: 4rem 1.25rem; }
  .section-title::after { max-width: none; }
  .projects-grid { grid-template-columns: 1fr; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}
