/* Typography & Theme */
:root {
  --bg: #0b1220;
  --bg-elev: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --card: #0f172a;
  --border: #1f2a44;
  --brand: #60a5fa;
  --brand-ink: #0b1220;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
}

/* Light theme removed; dark-only site */

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Soft dynamic background accents */
body::before {
  content: "";
  position: fixed;
  inset: -10% -10% -10% -10%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.32;
  filter: blur(70px) saturate(120%);
  background:
    radial-gradient(720px 440px at 12% 18%, color-mix(in srgb, var(--brand) 48%, transparent), transparent 60%),
    radial-gradient(620px 420px at 88% 22%, color-mix(in srgb, #22d3ee 38%, transparent), transparent 60%),
    radial-gradient(760px 520px at 50% 108%, color-mix(in srgb, #a78bfa 32%, transparent), transparent 60%),
    radial-gradient(540px 320px at 50% -8%, color-mix(in srgb, #f59e0b 18%, transparent), transparent 60%);
  animation: bg-drift 30s ease-in-out infinite;
}

@keyframes bg-drift {
  0% { 
    transform: translate3d(0, 0, 0) scale(1);
    background-position: 12% 18%, 88% 22%, 50% 108%, 50% -8%;
  }
  25% { 
    transform: translate3d(15%, -10%, 0) scale(1.1);
    background-position: 35% 40%, 60% 45%, 25% 70%, 75% 15%;
  }
  50% { 
    transform: translate3d(8%, 20%, 0) scale(1.2);
    background-position: 45% 50%, 50% 55%, 15% 60%, 85% 25%;
  }
  75% { 
    transform: translate3d(-12%, 12%, 0) scale(1.15);
    background-position: 25% 60%, 70% 65%, 35% 50%, 65% 35%;
  }
  100% { 
    transform: translate3d(0, 0, 0) scale(1);
    background-position: 12% 18%, 88% 22%, 50% 108%, 50% -8%;
  }
}

/* Layout */
.container {
  width: 100%;
  max-width: 1000px;
  padding: 0 16px;
  margin: 0 auto;
}

.section { padding: 56px 0; }
.hero { padding: 152px 0 56px; background: linear-gradient(180deg, rgba(96,165,250,0.08), transparent 35%); }
.hero-content { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.hero-text { max-width: 600px; }
.hero .subhead { max-width: 720px; }
.hero .actions { display: flex; gap: 10px; margin-top: 12px; }
.hero .socials { margin-top: 10px; }
.hero .meta { margin-top: 8px; }

/* Profile picture styling */
.hero-image { display: flex; justify-content: center; align-items: center; }
.profile-picture {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--brand) 15%, var(--border));
  background: var(--card);
  position: relative;
}

.profile-picture::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--brand), #22d3ee, #a78bfa);
  z-index: -1;
  opacity: 0.6;
}

.profile-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.5);
}

/* Header */
.site-header {
  position: fixed !important; 
  top: 0 !important; 
  left: 0; 
  right: 0; 
  width: 100%;
  z-index: 2147483647;
  background: var(--bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; position: relative; }
.brand { 
  color: var(--text); 
  text-decoration: none; 
  font-weight: 800; 
  letter-spacing: 0.5px; 
  position: relative;
  display: inline-block;
  min-width: 200px;
}

.brand-short {
  display: inline-block;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.brand-full {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
}

.brand.expanded .brand-short {
  opacity: 0;
  transform: translateX(10px);
}

.brand.expanded .brand-full {
  opacity: 1;
  transform: translateX(0);
}

.nav-toggle { display: none; }
.nav { position: relative; z-index: 10001; }

.nav-list { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav-list a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-list a:hover { color: var(--text); }

.theme-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}

/* Text */
h1 { font-size: clamp(30px, 5.5vw, 48px); line-height: 1.1; margin: 6px 0 10px; }
h2 { font-size: clamp(20px, 2.6vw, 26px); margin: 0 0 16px; }
h3 { font-size: 17px; margin: 0; }
h4 { font-size: 15px; margin: 0 0 6px; color: var(--muted); }
.eyebrow { letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; font-size: 12px; }
.muted { color: var(--muted); }

/* Components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 600; border-radius: 10px; padding: 8px 12px; border: 1px solid var(--border); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.ghost { background: transparent; color: var(--text); }
.btn:hover { filter: brightness(1.05); }

.card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  border-radius: 14px;
  padding: 14px 14px;
  box-shadow: var(--shadow);
}
/* Remove sibling margin to avoid misalignment inside grids; spacing is handled by grid gaps */
/* .card + .card { margin-top: 12px; } */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
/* Better badge layout for projects */
#projects .card .card-head {
  align-items: flex-start;
}

#projects .card .card-head h3 {
  flex: 1;
  min-width: 0;
}

#projects .card .card-head .badge {
  flex-shrink: 0;
  margin-top: 2px;
}
.badge { background: color-mix(in srgb, var(--brand) 15%, var(--bg)); color: var(--text); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
.badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Expandable cards */
details.card { padding: 0; overflow: hidden; }
details.card > summary { list-style: none; cursor: pointer; padding: 14px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { border-bottom: 1px solid var(--border); background: var(--bg-elev); }
details.card .card-content { padding: 12px 14px; }

/* Clickable cards (stretched link) */
.card.link { position: relative; transition: transform .08s ease, border-color .12s ease, box-shadow .12s ease; }
.card.link:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08), var(--shadow); }
.stretched-link { position: absolute; inset: 0; z-index: 10; border-radius: inherit; text-indent: -9999px; overflow: hidden; }
.card .card-body { position: relative; }

/* Breadcrumbs */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.page-header { padding: 40px 0 8px; }

/* Text list sections */
.text-list { display: grid; gap: 8px; }
.text-link { color: var(--text); text-decoration: none; font-weight: 600; }
.text-link:hover { text-decoration: underline; }

/* Prose (compact detail pages) */
.prose { max-width: 800px; }
.prose h2 { font-size: 17px; margin: 12px 0 6px; color: var(--muted); }
.prose p { margin: 8px 0; }
.prose ul { margin: 6px 0 8px 18px; }
.prose li { margin: 4px 0; }

.video { position: relative; width: 100%; max-width: 800px; aspect-ratio: 16 / 9; margin: 12px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 14px; box-shadow: var(--shadow); background: #000; }

.list { margin: 6px 0 0; padding-left: 18px; }
.list li { margin: 4px 0; }

.stack { display: grid; gap: 12px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
/* Ensure equal-height cards inside 3-col grids */
.grid.three > .card { height: 100%; display: flex; flex-direction: column; }
/* Normalize card heights in grids by enforcing a min-height */
.grid.three > .card { min-height: 220px; }
.card .card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
/* Clamp descriptions to keep card heights consistent */
.card .card-body p:last-of-type {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Skills Groups */
.skills-groups { display: flex; flex-direction: column; gap: 24px; }
.skill-group h3 { 
  margin: 0 0 12px 0; 
  color: var(--text); 
  font-size: 14px; 
  font-weight: 600; 
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 12px; }

.contact { display: flex; gap: 10px; flex-wrap: wrap; }

/* Social icons */
.socials { display: flex; gap: 12px; align-items: center; }
.social-link {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text); text-decoration: none;
  box-shadow: var(--shadow);
  transition: filter .12s ease, border-color .12s ease, transform .08s ease;
}
.social-link:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); filter: brightness(1.05); transform: translateY(-1px); }

.site-footer { border-top: 1px solid var(--border); padding: 22px 0; }

/* Ensure content layers above background */
.site-footer { position: relative; z-index: 1; }


/* Honors display */
.marquee { position: relative; overflow: visible; padding: 8px 0; z-index: 2; }
.marquee__track { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.marquee__group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.marquee__item { white-space: nowrap; }
/* Larger, accented chips within honors */
.marquee .chip { font-size: 14px; padding: 10px 14px; border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); background-image: linear-gradient(180deg, color-mix(in srgb, var(--brand) 8%, transparent), transparent); }

/* JS-driven tooltip container */
#tooltip {
  position: fixed;
  left: 0; top: 0;
  transform: translate(-50%, 0);
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 10000;
}
#tooltip[data-pos="above"] { transform: translate(-50%, -10px); }
#tooltip[data-pos="below"] { transform: translate(-50%, 10px); }

/* Enhanced Mobile Responsiveness */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .container {
    padding: 0 20px;
  }
  
  .hero-content {
    gap: 40px;
  }
  
  .profile-picture {
    width: 180px;
    height: 180px;
  }
}

/* Tablets */
@media (max-width: 900px) {
  .grid.two { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three > .card { min-height: unset; }
  
  .hero-content {
    gap: 32px;
  }
  
  .profile-picture {
    width: 160px;
    height: 160px;
  }
  
  .section {
    padding: 48px 0;
  }
  
  .hero {
    padding: 80px 0 48px;
  }
}

/* Mobile navigation and layout */
@media (max-width: 760px) {
  .nav-toggle { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    background: transparent; 
    border: 1px solid var(--border); 
    color: var(--text); 
    padding: 8px 10px; 
    border-radius: 10px; 
    cursor: pointer;
    font-size: 16px;
    z-index: 10002;
    position: relative;
    transition: all 0.3s ease;
  }

  .nav-toggle[aria-expanded="true"] {
    background: color-mix(in srgb, var(--brand) 10%, transparent);
    border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
    transform: rotate(90deg);
  }
  
  
  .nav-list { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw;
    height: 100vh;
    background: var(--bg); 
    display: none; 
    flex-direction: column; 
    justify-content: flex-start;
    align-items: center;
    z-index: 2147483646;
    padding: 80px 20px 20px;
    overflow-y: auto;
    gap: 8px;
  }
  
  .nav-list.open { 
    display: flex; 
    animation: fadeIn 0.3s ease-out;
  }
  
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  .nav-list li {
    margin: 0;
    text-align: center;
    width: 100%;
    max-width: 300px;
  }
  
  .nav-list a {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border));
    text-align: center;
  }
  
  .nav-list a:hover {
    background-color: color-mix(in srgb, var(--brand) 15%, transparent);
    border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
    transform: translateY(-2px);
  }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  
  .hero-text {
    max-width: none;
  }
  
  .profile-picture {
    width: 140px;
    height: 140px;
    margin: 0 auto;
  }
  
  .hero {
    padding: 64px 0 40px;
  }
  
  .section {
    padding: 40px 0;
  }
  
  .hero .actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .hero .socials {
    justify-content: center;
  }
  
  .socials {
    gap: 10px;
  }
  
  .social-link {
    width: 36px;
    height: 36px;
  }
  
  .grid.three {
    grid-template-columns: 1fr;
  }
  
  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .card-head .badge {
    align-self: flex-start;
  }
  
  /* Better badge layout on mobile for projects */
  #projects .card .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  #projects .card .card-head h3 {
    flex: none;
  }
  
  #projects .card .card-head .badge {
    margin-top: 0;
  }
  
  .chips {
    gap: 6px;
  }
  
  .chip {
    font-size: 11px;
    padding: 6px 8px;
  }
  
  .contact {
    justify-content: center;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  /* Improve marquee for mobile */
  .marquee {
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  }
  
  .marquee .chip {
    font-size: 12px;
    padding: 8px 12px;
  }
  
  /* Better spacing for mobile */
  .card {
    padding: 16px;
  }
  
  .card .card-body {
    gap: 8px;
  }
  
  .card .card-body p:last-of-type {
    -webkit-line-clamp: 3;
  }
  
  /* Improve video responsiveness */
  .video {
    margin: 16px 0;
  }
  
  /* Better prose spacing on mobile */
  .prose h2 {
    margin: 16px 0 8px;
  }
  
  .prose p {
    margin: 10px 0;
  }
  
  .prose ul {
    margin: 8px 0 12px 20px;
  }
  
  .prose li {
    margin: 6px 0;
  }
  
  /* Improve breadcrumb on mobile */
  .breadcrumb {
    font-size: 12px;
    margin-bottom: 12px;
  }
  
  .page-header {
    padding: 32px 0 12px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
  
  .hero {
    padding: 56px 0 32px;
  }
  
  .section {
    padding: 32px 0;
  }
  
  .profile-picture {
    width: 120px;
    height: 120px;
  }
  
  .hero .subhead {
    font-size: 14px;
    line-height: 1.5;
  }
  
  .eyebrow {
    font-size: 11px;
  }
  
  .card {
    padding: 14px;
  }
  
  .social-link {
    width: 32px;
    height: 32px;
  }
  
  .social-link svg {
    width: 16px;
    height: 16px;
  }
  
  .chips {
    gap: 4px;
  }
  
  .chip {
    font-size: 10px;
    padding: 5px 7px;
  }
  
  .marquee .chip {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  /* Improve navigation for very small screens */
  .nav-list {
    right: 8px;
    min-width: 140px;
  }
  
  .nav-list a {
    padding: 6px 10px;
    font-size: 14px;
  }
  
  /* Better grid spacing for small screens */
  .grid {
    gap: 10px;
  }
  
  .stack {
    gap: 10px;
  }
  
  /* Improve contact section */
  .contact {
    flex-direction: column;
    align-items: center;
  }
  
  .contact .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
  .container {
    padding: 0 10px;
  }
  
  .hero {
    padding: 48px 0 24px;
  }
  
  .section {
    padding: 24px 0;
  }
  
  .profile-picture {
    width: 100px;
    height: 100px;
  }
  
  .card {
    padding: 12px;
  }
  
  .social-link {
    width: 28px;
    height: 28px;
  }
  
  .social-link svg {
    width: 14px;
    height: 14px;
  }
  
  .chip {
    font-size: 9px;
    padding: 4px 6px;
  }
  
  /* Ensure badges don't get too small on very small screens */
  .badge {
    font-size: 11px;
    padding: 3px 8px;
  }
  
  .marquee .chip {
    font-size: 10px;
    padding: 5px 8px;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .nav-list {
    min-width: 120px;
  }
  
  .nav-list a {
    padding: 5px 8px;
    font-size: 13px;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 40px 0 24px;
  }
  
  .profile-picture {
    width: 80px;
    height: 80px;
  }
  
  .hero-content {
    gap: 20px;
  }
  
  .section {
    padding: 24px 0;
  }
}

/* Loading state for better mobile experience */
body:not(.loaded) {
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.loaded {
  opacity: 1;
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .social-link:hover,
  .card.link:hover {
    transform: none;
    filter: none;
  }
  
  .btn:active,
  .social-link:active,
  .card.link:active {
    transform: scale(0.98);
  }
  
  /* Improve touch targets */
  .btn,
  .social-link,
  .nav-list a {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better touch feedback */
  .card.link {
    transition: transform 0.1s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  }
  
  .card.link:active {
    transform: translateY(0);
    border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
  }
}

/* Motion */
html:focus-within { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}


