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

:root {
  --bg:             #0d1117;
  --surface:        #161b22;
  --surface-hover:  #1c2333;
  --border:         rgba(255,255,255,0.07);
  --border-accent:  rgba(129,140,248,0.35);
  --text:           #e6edf3;
  --text-muted:     #8b949e;
  --text-dim:       #6e7681;
  --accent:         #818cf8;
  --accent-glow:    rgba(129,140,248,0.12);
  --accent-2:       #34d399;
  --font:           'Inter', system-ui, sans-serif;
  --font-mono:      'Fira Code', 'SF Mono', monospace;
  --font-serif:     'Playfair Display', Georgia, serif;
  --nav-h:          60px;
  --max-w:          900px;
  --radius:         12px;
  --shadow:         0 4px 24px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

/* Subtle radial glow on background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(129,140,248,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 85%, rgba(52,211,153,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

main, nav, footer { position: relative; z-index: 1; }

/* ===== NAVIGATION ===== */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(13,17,23,0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

#navbar.scrolled {
  background: rgba(13,17,23,0.95);
  border-bottom-color: rgba(255,255,255,0.1);
}

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

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
  transition: color 0.2s;
}

.nav-brand:hover { color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.125rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* ===== NAV DROPDOWN (Academics) ===== */
.dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.nav-dropdown-toggle .chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.2s;
}

.dropdown.open .nav-dropdown-toggle .chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 200px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 1100;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .dropdown:hover .nav-dropdown-toggle .chevron {
    transform: rotate(180deg);
  }
}

.dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* ===== MAIN LAYOUT ===== */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
}

/* Subpages (non-hero) need top clearance for the fixed navbar */
body.subpage main {
  padding-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}

body.subpage section {
  padding-top: 3rem;
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  padding-top: var(--nav-h);
  position: relative;
}

/* Greeter (typing animation) */
#greeter {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  white-space: nowrap;
}

.caret { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Font classes for typing animation */
.font-display { font-family: var(--font); }
.font-serif   { font-family: var(--font-serif); }
.font-mono    { font-family: var(--font-mono); }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, #e6edf3 0%, var(--accent) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.25rem;
  letter-spacing: 0.01em;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: 9999px;
  color: var(--accent);
  white-space: nowrap;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.icon-link svg { width: 15px; height: 15px; flex-shrink: 0; }

.icon-link:hover {
  color: var(--text);
  border-color: var(--border-accent);
  background: var(--accent-glow);
}

/* Photo */
.hero-photo {
  float: right;
  margin: 0 0 1.5rem 3rem;
  shape-outside: circle(50%);
  shape-margin: 1rem;
}

.photo-frame {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  padding: 3px;
  box-shadow: 0 0 48px rgba(129,140,248,0.25), 0 0 0 1px rgba(129,140,248,0.1);
}

.photo-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  user-select: none;
}

.photo-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: opacity 0.3s;
}

/* Scroll hint chevron */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  animation: bounce 2s ease-in-out infinite;
}

.scroll-hint:hover { color: var(--accent); }

.scroll-hint svg { width: 24px; height: 24px; }

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ===== PROJECTS ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card:hover {
  border-color: var(--border-accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-card h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.project-card h3 a:hover { color: var(--accent); }

.project-stack {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  line-height: 1.5;
}

.project-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 0.25rem;
}

/* ===== TOOLS ===== */
.tools-intro {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
  max-width: 640px;
  margin-bottom: 2rem;
}

.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Subsection heading within a page (e.g. Tools / Writing on Resources) */
.subsection-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 2.5rem 0 1rem;
}

.subsection-title:first-of-type { margin-top: 0.5rem; }

/* ===== BLOG POST (article prose) ===== */
.post {
  max-width: 680px;
}

.post-header { margin-bottom: 2.5rem; }

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.post-title {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
}

.post-body { color: var(--text-muted); font-size: 1rem; line-height: 1.8; }
.post-body > * + * { margin-top: 1.25rem; }
.post-body h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-top: 2.25rem;
}
.post-body h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-top: 1.75rem; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li { margin-bottom: 0.4rem; }
.post-body blockquote {
  border-left: 3px solid var(--accent-2);
  padding-left: 1.25rem;
  color: var(--text);
  font-style: italic;
}
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
}
.post-body img { max-width: 100%; border-radius: var(--radius); }

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.post-back:hover { color: var(--accent); }
.post-back svg { width: 14px; height: 14px; }

.tool-callout {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 1.375rem 1.5rem;
  text-decoration: none;
  transition: border-left-color 0.2s, background 0.2s, transform 0.2s;
}

.tool-callout:hover {
  border-left-color: var(--accent);
  background: var(--surface-hover);
  transform: translateX(2px);
}

.tool-callout h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.tool-callout p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.tool-callout .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  display: block;
}

/* Primary call-to-action button (hero) */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  margin-bottom: 1.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 1px solid transparent;
  box-shadow: 0 0 24px rgba(129,140,248,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.hero-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(129,140,248,0.35);
}

.hero-cta svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ===== EXPERIENCE TIMELINE ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.375rem 1.5rem;
  transition: border-left-color 0.2s, background 0.2s, transform 0.2s;
}

.timeline-item:hover {
  border-left-color: var(--accent-2);
  background: var(--surface-hover);
  transform: translateX(2px);
}

.timeline-item h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.timeline-item h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.timeline-item h3 a:hover { color: var(--accent); }

.timeline-company {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--accent);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
  margin-bottom: 0.875rem;
}

.timeline-item ul {
  padding-left: 1.25rem;
}

.timeline-item li {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.4rem;
}

.timeline-item li:last-child { margin-bottom: 0; }

/* ===== EDUCATION ===== */
#education-block {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.education-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  transition: border-color 0.2s, background 0.2s;
}

.education-card:hover {
  border-color: var(--border-accent);
  background: var(--surface-hover);
}

.education-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.education-degree {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.education-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.875rem;
}

.education-details {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===== CONTACT ===== */
#contact {
  text-align: center;
}

.contact-intro {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.contact-links a:hover {
  color: var(--text);
  border-color: var(--border-accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 680px) {
  .hero {
    min-height: auto;
    padding-top: calc(var(--nav-h) + 3rem);
    padding-bottom: 4rem;
  }

  .hero-photo {
    float: none;
    shape-outside: none;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
  }

  .photo-frame { width: 150px; height: 150px; }

  .photo-placeholder { font-size: 1.8rem; }

  .scroll-hint { display: none; }

  .nav-links {
    overflow-x: auto;
    max-width: 62vw;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar { display: none; }

  .nav-links a,
  .nav-dropdown-toggle { font-size: 0.8rem; padding: 0.35rem 0.6rem; }

  .dropdown-menu { min-width: 180px; }

  .project-grid { grid-template-columns: 1fr; }

  section { padding: 3.5rem 0; }

  main { padding: 0 1.25rem; }
}

@media (max-width: 400px) {
  h1 { font-size: 2rem; }
}
