/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Colors: Light mode */
  --bg:          #fafaf8;
  --bg-2:        #f2f2ef;
  --text:        #1c1c1e;
  --text-2:      #636366;
  --accent:      #1d4ed8;
  --border:      #e4e4e1;
  --card-bg:     #ffffff;
  --chip-bg:     #efefec;

  /* Typography */
  --font:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Spacing */
  --sp-xs:   0.25rem;
  --sp-sm:   0.5rem;
  --sp-md:   1rem;
  --sp-lg:   2rem;
  --sp-xl:   3.5rem;
  --sp-2xl:  6rem;

  /* Layout */
  --max-w:       840px;
  --nav-h:       3.5rem;
  --radius:      6px;
  --radius-sm:   4px;

  --transition:  150ms ease;
}

[data-theme="dark"] {
  --bg:          #0f0f0f;
  --bg-2:        #1a1a1a;
  --text:        #ebebeb;
  --text-2:      #888888;
  --accent:      #7eb3f5;
  --border:      #272727;
  --card-bg:     #171717;
  --chip-bg:     #202020;
}


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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 200ms ease, color 200ms ease;
}

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

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

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-md);
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 200ms ease;
}
.skip-link:focus {
  top: var(--sp-sm);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* ============================================================
   UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.mono {
  font-family: var(--mono);
}


/* ============================================================
   NAVIGATION
   ============================================================ */
.nav-wrapper {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background 200ms ease;
}

.nav {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  gap: var(--sp-lg);
}

.nav-logo {
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text);
  flex-shrink: 0;
  transition: color var(--transition);
}
.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  flex: 1;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-2);
  white-space: nowrap;
  transition: color var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.theme-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { display: block; }

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 200ms ease, opacity 200ms ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* ============================================================
   SECTION SHELL
   ============================================================ */
.section {
  padding: var(--sp-2xl) 0;
  border-top: 1px solid var(--border);
}

.section-full {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--nav-h) + var(--sp-xl));
  padding-bottom: var(--sp-xl);
}

.section-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--sp-sm);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: var(--sp-lg);
  line-height: 1.2;
}


/* ============================================================
   HERO
   ============================================================ */
.hero-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2xl);
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-label {
  font-size: 0.8125rem;
  color: var(--text-2);
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-md);
}

.hero-name {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.04;
  color: var(--text);
  margin-bottom: var(--sp-lg);
}

.hero-intro {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 52ch;
  margin-bottom: var(--sp-xl);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-2);
  transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}
.hero-link svg { flex-shrink: 0; }
.hero-link:hover {
  border-color: var(--text-2);
  color: var(--text);
}
.hero-link--accent {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-link--accent:hover {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.hero-avatar {
  flex-shrink: 0;
  position: relative;
}

.hero-avatar img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.avatar-fallback {
  display: none;
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-2);
}


/* ============================================================
   ABOUT
   ============================================================ */
.about-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  max-width: 62ch;
}

.about-text p {
  color: var(--text-2);
  line-height: 1.72;
}


/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--sp-md);
}

.skill-card {
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.skill-card-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  margin-bottom: var(--sp-md);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs) var(--sp-sm);
}

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  color: var(--text);
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-lg);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  transition: border-color var(--transition);
}
.project-card:hover {
  border-color: var(--text-2);
}

.project-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.3;
}

.project-summary {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs) 0.375rem;
}

.project-psr {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.psr-row {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.psr-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.psr-text {
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.5;
}

.project-links {
  display: flex;
  gap: var(--sp-sm);
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.7188rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.275rem 0.6rem;
  transition: color var(--transition), border-color var(--transition);
}
.project-link svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }
.project-link:hover {
  color: var(--text);
  border-color: var(--text-2);
}


/* ============================================================
   EXPERIENCE TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 1.375rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.625rem;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--sp-xl);
}
.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1.375rem - 4px);
  top: 0.5625rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-2);
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--sp-sm);
  row-gap: 0;
  margin-bottom: var(--sp-xs);
}

.timeline-role {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.timeline-sep {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.timeline-org {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
  transition: opacity var(--transition);
}
a.timeline-org:hover { opacity: 0.75; }

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}

.timeline-dates,
.timeline-location {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
}

.timeline-location::before {
  content: '·';
  margin-right: var(--sp-sm);
  color: var(--border);
}

.timeline-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-bullet {
  position: relative;
  padding-left: 1rem;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
}
.timeline-bullet::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 1px;
  background: var(--text-2);
  opacity: 0.4;
}


/* ============================================================
   ACADEMICS
   ============================================================ */
.academics-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2xl);
  list-style: none;
}

.academics-level-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border);
}

.academics-level-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.academics-level-institution {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.academics-courses {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-lg);
  list-style: none;
}

.academics-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.academics-code {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.academics-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.academics-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}


/* ============================================================
   HACKATHONS
   ============================================================ */
.hackathons-list {
  display: flex;
  flex-direction: column;
}

.hackathon-item {
  display: grid;
  grid-template-rows: auto auto auto auto;
  padding: var(--sp-lg) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--sp-xs);
}
.hackathon-item:first-child {
  border-top: 1px solid var(--border);
}

.hackathon-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.hackathon-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.hackathon-rank {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.hackathon-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
}

.hackathon-meta span + span::before {
  content: ' · ';
}

.hackathon-what {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
  padding-top: var(--sp-xs);
}

.hackathon-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs) 0.375rem;
  padding-top: var(--sp-xs);
}

.hackathon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.7188rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  margin-top: var(--sp-xs);
  align-self: flex-start;
  transition: color var(--transition), border-color var(--transition);
}
.hackathon-link svg { width: 0.875rem; height: 0.875rem; }
.hackathon-link:hover {
  color: var(--text);
  border-color: var(--text-2);
}


/* ============================================================
   SPORT
   ============================================================ */
.sport-list {
  display: flex;
  flex-direction: column;
}

.sport-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-md);
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.sport-item:first-child {
  border-top: 1px solid var(--border);
}

.sport-discipline {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  min-width: 8rem;
  flex-shrink: 0;
}

.sport-detail {
  font-size: 0.9375rem;
  color: var(--text-2);
  flex: 1;
}

.sport-stat {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.sport-note {
  font-size: 0.8125rem;
  color: var(--text-2);
  font-style: italic;
  width: 100%;
  padding-left: calc(8rem + var(--sp-md));
}


/* ============================================================
   WRITING
   ============================================================ */
.writing-empty {
  font-size: 0.9375rem;
  color: var(--text-2);
  font-style: italic;
}

.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-lg);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
}
.writing-item:first-child {
  border-top: 1px solid var(--border);
}

.writing-item time {
  font-size: 0.75rem;
  color: var(--text-2);
  flex-shrink: 0;
}

.writing-item a {
  font-size: 0.9375rem;
  color: var(--text);
  transition: color var(--transition);
}
.writing-item a:hover { color: var(--accent); }


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-xl) 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md) var(--sp-lg);
}

.footer-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-2);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--text); }

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-2);
}


/* ============================================================
   FADE-IN ANIMATION
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 480ms ease, transform 480ms ease;
  }
  .fade-in.visible {
    opacity: 1;
    transform: none;
  }
}


/* ============================================================
   RESPONSIVE: TABLET
   ============================================================ */
@media (max-width: 720px) {
  :root {
    --sp-2xl: 4rem;
    --sp-xl:  2.5rem;
  }

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

  .academics-courses {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   RESPONSIVE: MOBILE
   ============================================================ */
@media (max-width: 560px) {
  :root {
    --sp-lg: 1.25rem;
  }

  .container {
    padding: 0 var(--sp-md);
  }

  /* Hamburger nav */
  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .theme-toggle {
    order: 3;
  }

  .nav-links {
    display: none;
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-sm);
    padding: var(--sp-md) var(--sp-lg);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 99;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    font-size: 1rem;
    padding: var(--sp-xs) 0;
  }

  /* Hero stacks: avatar above, text below */
  .hero-inner {
    flex-direction: column-reverse;
    gap: var(--sp-lg);
  }

  .hero-avatar img,
  .avatar-fallback {
    width: 100px;
    height: 100px;
  }

  .hero-name {
    font-size: clamp(2.75rem, 13vw, 3.5rem);
  }

  /* Skills: single column */
  .skills-grid {
    grid-template-columns: 1fr;
  }

  /* Sport: stack on mobile */
  .sport-discipline {
    min-width: unset;
    width: 100%;
  }
  .sport-note {
    padding-left: 0;
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
