/*
  AI usage: written with Claude Code (CMU 15-113). See PROMPT_LOG.md for the full session.
  Notable AI-assisted debugging: the responsive rules below fix a real CSS Grid/Flexbox bug Claude
  found — a grid/flex item's "automatic minimum size" can force layout wider than its container even
  when every rule looks constrained, which was causing horizontal overflow on narrow screens.
*/

/* ---------- Design tokens ---------- */
:root {
  --bg: #fafaf9;
  --bg-elevated: #ffffff;
  --text: #1c1c1e;
  --text-muted: #5b5b60;
  --border: #e6e6e4;
  --accent: #0f766e;
  --accent-hover: #0b5a54;
  --accent-soft: #e6f4f2;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --font-heading: "Poppins", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1417;
  --bg-elevated: #171d21;
  --text: #f2f2f0;
  --text-muted: #a3a8ab;
  --border: #2a3237;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: #16302c;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; }

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

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 96px 0; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
  position: relative;
}

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

.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}

.icon-btn .icon { width: 18px; height: 18px; }

.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------- Hero / About ---------- */
.hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 64px;
  align-items: start;
  padding-top: 72px;
}

.hero-photo,
.hero-text {
  min-width: 0;
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--bg-elevated);
  box-shadow: var(--shadow);
}

.avatar-fallback {
  display: none;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #10b981);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.hero-text h1 { font-size: 2.6rem; font-weight: 700; margin-bottom: 6px; }

.subtitle { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 20px; }

.bio { margin-bottom: 28px; max-width: 60ch; }

.chip-group { margin-bottom: 20px; }

.chip-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Skills are grouped by category: a label on the left, that category's chips on the right */
.skill-rows { display: flex; flex-direction: column; gap: 12px; }

.skill-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: baseline;
}

.skill-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }

/* ---------- Course marquee ---------- */
.course-marquee-wrap {
  position: relative;
}

.course-marquee {
  overflow: hidden;
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent);
}

.course-track {
  display: flex;
  gap: 16px;
  width: max-content;
  will-change: transform;
}

.course-block {
  flex: 0 0 auto;
  width: 216px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.course-block:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.course-code {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.course-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.marquee-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.marquee-nav svg { width: 20px; height: 20px; }

.course-marquee-wrap:hover .marquee-nav {
  opacity: 1;
  pointer-events: auto;
}

.marquee-nav:hover { border-color: var(--accent); background: var(--accent-soft); }

.marquee-prev { left: -8px; }

.marquee-next { right: -8px; }

@media (max-width: 640px) {
  .marquee-nav { opacity: 1; pointer-events: auto; }
  .marquee-prev { left: 2px; }
  .marquee-next { right: 2px; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn .icon { width: 18px; height: 18px; }

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

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-secondary {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
}

.btn-secondary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ---------- Section headings ---------- */
.section-title { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }

.section-subtitle { color: var(--text-muted); margin-bottom: 48px; max-width: 60ch; }

#projects .section-subtitle { max-width: none; }

@media (min-width: 700px) {
  #projects .section-subtitle { white-space: nowrap; }
}

/* ---------- Projects ---------- */
.group-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 56px 0 20px;
}

.section-subtitle + .group-heading {
  margin-top: 0;
}

.project-list {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.project-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  padding: 52px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.project-item:first-child { padding-top: 0; }

.project-item:last-child { border-bottom: none; }

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-tag {
  align-self: flex-start;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.project-period {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.project-body { min-width: 0; }

.project-body h3 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 14px;
  transition: color 0.2s ease;
}

.project-item:hover .project-body h3 { color: var(--accent); }

.project-body p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 62ch;
  margin-bottom: 16px;
}

.card-highlights {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-highlights li { padding-left: 18px; position: relative; }

.card-highlights li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.card-footer-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
}

.project-screenshot-wrap {
  flex: 0 1 260px;
  max-width: 100%;
  align-self: flex-start;
}

.project-screenshot {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.project-link:hover { text-decoration: underline; }

.project-link .icon { width: 15px; height: 15px; }

/* ---------- Interests / photo carousel ---------- */
.interest-body {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
}

.interest-text {
  flex: 1 1 260px;
  min-width: 0;
}

.carousel {
  position: relative;
  flex: 0 0 300px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.45s ease;
}

.carousel-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-next {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.carousel-next svg { width: 18px; height: 18px; }

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: background 0.2s ease;
}

.dot.active { background: #fff; }

/* ---------- Achievements ---------- */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.achievement-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.achievement-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.achievement-index {
  position: absolute;
  top: -6px;
  right: 14px;
  font-family: var(--font-heading);
  font-size: 3.4rem;
  font-weight: 700;
  color: var(--accent-soft);
  line-height: 1;
  z-index: 0;
  user-select: none;
}

.achievement-card .project-tag,
.achievement-card h3,
.achievement-card p {
  position: relative;
  z-index: 1;
}

.achievement-card .project-tag { align-self: flex-start; }

.achievement-card h3 { font-size: 1.2rem; padding-right: 30px; }

.achievement-card p { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Contact ---------- */
.contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  width: 100%;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease, gap 0.2s ease;
}

.contact-link:first-child { padding-top: 0; }

.contact-link:last-child { border-bottom: none; }

.contact-link:hover { color: var(--accent); gap: 24px; }

.contact-link .icon { width: 19px; height: 19px; color: var(--accent); flex-shrink: 0; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-credit {
  margin-top: 6px;
  font-size: 0.78rem;
}

.footer-credit a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-credit a:hover { color: var(--accent); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-photo { width: 180px; margin: 0 auto; }
  .chip-group, .chips { justify-content: center; }
  .chips { justify-content: center; }
  .skill-row { grid-template-columns: 1fr; gap: 8px; }
  .bio { max-width: none; }
  .project-item { grid-template-columns: 1fr; gap: 12px; }
  .achievement-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .section { padding: 64px 0; }
  .nav-links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-links.open { max-height: calc(100vh - 68px); overflow-y: auto; }
  .nav-links a { padding: 16px 24px; border-bottom: 1px solid var(--border); }
  .hamburger { display: flex; }
  .hero-text h1 { font-size: 2.1rem; }
  .project-item { padding: 40px 0; }
  .project-body h3 { font-size: 1.35rem; }
  .achievement-grid { grid-template-columns: 1fr; }
}
