:root {
  --bg: #0a1428;
  --bg-elev: #0f1d3a;
  --text: #e6ecff;
  --muted: #b6c2e2;
  --primary: #2f6fff;
  --primary-600: #2a5bdd;
  --border: #1f2b4d;
  --chip-bg: #13244a;
  --container-padding: 4%;
}

* { box-sizing: border-box; }
html, body { 
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
html {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: 
    radial-gradient(1200px 600px at 80% -10%, #112154 0%, var(--bg) 55%),
    radial-gradient(1200px 600px at 20% -10%, #112154 0%, var(--bg) 55%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  word-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  position: relative;
}

/* Improve readability on mobile */
p, li, .chip, .time-range {
  line-height: 1.5;
}

/* Better touch targets for mobile */
a, button, .chip {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
}

/* Prevent horizontal overflow */
img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

/* Better spacing for mobile */
section {
  margin-bottom: 1.5rem;
}

/* Improve form elements on mobile */
input, select, textarea, button {
  font-size: 16px; /* Prevent zoom on focus in iOS */
}

.container { 
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 4%;
  box-sizing: border-box;
  position: relative;
}

.site-header {
  position: sticky; top: 0; backdrop-filter: blur(8px);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.header-inner { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 14px 0;
  flex-wrap: wrap;
  gap: 10px;
}
.brand { color: var(--text); font-weight: 700; text-decoration: none; letter-spacing: 0.2px; }
.nav { display: flex; gap: 10px; align-items: center; }
.nav-link { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.nav-link:hover { color: var(--text); background: var(--chip-bg); }

.hero { 
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 15px;
  position: relative;
  gap: 10px;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animation classes that will be added by JavaScript */
.timeline li.animate {
  animation: slideInFromLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Initially hide the timeline items */
.timeline li {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Staggered animation for each timeline item */
#experience-list li.animate:nth-child(1) { animation-delay: 1.5s; }


.hero .avatar {
  margin: 0 auto 10px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: fadeInScale 0.8s ease-out forwards;
  opacity: 0; /* Start invisible, animation will make it visible */
  transform-origin: center center;
  transition: all 0.3s ease;
}

.hero .avatar.animated {
  animation: fadeInScale 0.8s ease-out forwards;
}

.hero .avatar:hover {
  transform: scale(1.05) !important;
  box-shadow: 0px 0px 30px rgba(47, 111, 255, 0.5);
}

.hero .hero-text {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.hero h1 {
  animation: fadeInUp 0.6s ease-out 0.3s both;
  opacity: 0;
}

.hero .subtitle {
  animation: fadeInUp 0.6s ease-out 0.5s both;
  opacity: 0;
}

.contact {
  animation: fadeInUp 0.6s ease-out 0.7s both;
  opacity: 0;
}

/* Animate each contact chip with a slight delay */
.chip {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
  animation-delay: calc(0.7s + (var(--i, 0) * 0.1s));
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 30px 0;
  }
  
  .hero .avatar {
    margin: 0 auto;
  }
}
/* Avatar styles moved to .hero .avatar */
.hero h1 { 
  margin: 5px 0 2px; 
  font-size: 32px; 
  line-height: 1.2;
}
.subtitle { 
  color: var(--muted); 
  margin: 0 0 5px;
  font-size: 1.1em;
}
.contact { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px;
  justify-content: center;
  margin-top: 15px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .contact {
    justify-content: center;
  }
  
  .chip {
    padding: 8px 12px;
    font-size: 15px;
  }
}

/* Single column layout for sections */
.section {
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .section {
    padding: 0;
    margin-bottom: 30px;
  }
  
  .timeline {
    margin: 15px 0 0 0;
  }
  
  .timeline li {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
    margin: 0 0 12px 0;
  }
  
  .time-range {
    margin-bottom: 4px;
    font-size: 13px;
  }
  
  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }
}

h2 { margin-top: 28px; margin-bottom: 10px; font-size: 20px; }
.timeline { 
  list-style: none; 
  padding: 0; 
  margin: 20px 0 0 0; 
  display: grid; 
  gap: 14px; 
}
.timeline li { 
  background: var(--bg-elev); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 16px; 
  display: grid; 
  grid-template-columns: 90px 1fr; 
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.timeline li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.02) 0%, rgba(47, 111, 255, 0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  border-radius: 12px;
}

.timeline li:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border-color: rgba(47, 111, 255, 0.3);
}

.timeline li:hover::before {
  opacity: 1;
}

/* Add a subtle shine effect on hover */
.timeline li::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transition: 0.5s;
  z-index: 1;
}

.timeline li:hover::after {
  left: 100%;
}

@media (max-width: 480px) {
  .timeline li {
    padding: 14px 12px;
  }
}
/* Date column styling */
.date-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px;
  position: relative;
  margin-right: 16px;
  min-width: 100px;
}

/* Time range styling */
.time-range {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-feature-settings: 'tnum' on, 'lnum' on;
  line-height: 1.3;
}

.time-range .end-date {
  font-weight: 600;
  color: var(--text);
}

.time-range .start-date {
  opacity: 0.9;
}

/* Keep month and year on the same line */
.time-range .end-date,
.time-range .start-date {
  white-space: nowrap;
}

.time-range .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin: 0px 0;
  font-size: 20px;
}

.time-range .arrow svg {
  width: 12px;
  height: 2px;
  fill: currentColor;
}

/* Hover-only sliding arrow animation */
@keyframes arrow-slide {
  0% { transform: translate(-50%, 4px); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -4px); opacity: 0; }
}

/* Prepare container for pseudo-element */
.time-range .arrow {
  position: relative;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 12px;
  margin: 0px 0;
}

/* Style for the arrow SVG */
.time-range .arrow svg {
  width: 12px;
  height: 12px;
  stroke: var(--primary);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

/* Run animation only on hover */
.timeline li:hover .time-range .arrow svg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  animation: arrow-slide 0.9s ease-in-out infinite;
  stroke: currentColor;
}

/* Staggered duplicate arrow following the first */
.timeline li:hover .time-range .arrow::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='%235d8cff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  transform: translate(-50%, 6px);
  pointer-events: none;
  animation: arrow-slide 0.9s ease-in-out infinite;
  animation-delay: 0.45s; /* half-cycle delay */
  opacity: 0; /* Start invisible, animation will handle opacity */
}

/* Add a subtle color on hover */
.timeline li:hover .time-range {
  color: #a0b1d4;
}
.item-body h3 { 
  margin: 0 0 4px 0; 
  font-size: 18px; 
  line-height: 1.3;
  color: var(--text);
}

.item-body h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  opacity: 0.9;
}

.company-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-logo-container {
  width: 60px;
  height: 60px;
  padding: 0px;
  margin: 0 auto 8px;
  border-radius: 0px;
  background: transparent;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.company-logo-container:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Adjust spacing for mobile */
@media (max-width: 768px) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .time-range {
    margin-top: 4px;
    text-align: left;
  }
  
  .company-logo {
    width: 40px;
    height: 40px;
    margin: 0 0 4px;
  }
  
  .timeline > li > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .timeline > li > div:first-child .company-logo {
    margin: 0;
    width: 50px;
    height: 50px;
  }
}
.item-body p { 
  margin: 0 0 10px 0; 
  color: var(--muted);
  padding-left: 0;
  white-space: pre-line;
  line-height: 1.2;
  font-size: 14px;
}

/* Style for bullet points */
.item-body p {
  position: relative;
  padding-left: 1.5em;
  margin: 0 0 8px 0;
  line-height: 1.6;
}

/* Add bullet points */
.item-body p::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* Add some spacing between bullet points */
.item-body p:not(:last-child) {
  margin-bottom: 8px;
}

/* Style for links in content */
a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  font-weight: 500;
}

a:hover {
  color: #5d8cff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.contact a:hover {
  text-decoration: none;
}

a::after {
  content: '↗';
  font-size: 0.8em;
  margin-left: 2px;
  opacity: 0.8;
  display: inline-block;
  transition: transform 0.2s ease;
}

a:hover::after {
  transform: translate(2px, -2px);
}

/* Style for links in the education section */
#education-list a {
  color: #7aa2ff;
  border-bottom: 1px solid rgba(122, 162, 255, 0.3);
  padding-bottom: 1px;
  text-decoration: none;
}

#education-list a:hover {
  color: #a0bdff;
  border-bottom-color: rgba(160, 189, 255, 0.6);
  text-decoration: none;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--chip-bg); color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; text-decoration: none; font-size: 14px; }

.btn { 
  appearance: none; 
  border: 1px solid transparent; 
  border-radius: 10px; 
  padding: 12px 18px; 
  font-weight: 600; 
  color: var(--text); 
  text-decoration: none; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  gap: 8px; 
  font-size: 15px;
  transition: all 0.2s ease;
  min-height: 44px; /* Better touch target */
}

@media (max-width: 480px) {
  .btn {
    width: 100%;
    padding: 14px 20px;
  }
}
.btn:hover { transform: translateY(-1px); transition: transform .15s ease; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-600)); box-shadow: 0 10px 25px rgba(47,111,255,.25); }
.btn-outline { border-color: var(--border); background: transparent; }

.cta { 
  display: flex; 
  gap: 12px; 
  padding: 30px 0 50px;
  flex-wrap: wrap;
}

@media (max-width: 600px) { 
  .cta { 
    flex-direction: column;
    gap: 10px;
  } 
  
  .cta .btn {
    margin: 0 !important;
  }
}

.site-footer { border-top: 1px solid var(--border); margin-top: 24px; }
.site-footer p { color: var(--muted); text-align: center; padding: 16px 0 28px; margin: 0; }

/* Portfolio */
.filters { position: sticky; top: 58px; background: color-mix(in oklab, var(--bg) 70%, transparent); border-bottom: 1px solid var(--border); padding: 12px 0; z-index: 5; }
.filters .controls { display: grid; grid-template-columns: 1fr 200px 160px; gap: 10px; }
@media (max-width: 900px) { .filters .controls { grid-template-columns: 1fr; } }
.input, .select { width: 100%; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 10px; }

.grid.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 22px 0 36px; }
@media (max-width: 1000px) { .grid.cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cards { grid-template-columns: 1fr; } }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; height: 160px; object-fit: cover; background: #0a0f20; }
.card-body { padding: 12px; display: grid; gap: 6px; }
.card h3 { margin: 0; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.card .actions { margin-top: 6px; display: flex; gap: 8px; }
.no-results { color: var(--muted); text-align: center; padding: 28px 0; }
