/* =============================================
   CSS Custom Properties (Design Tokens)
   ============================================= */
:root {
  /* Original colors - keeping exact same appearance */
  --link-color: #1772d0;
  --link-hover: #f09228;
  --highlight-bg: #ffffd0;
  --text-color: inherit;

  /* Typography - keeping original Fira Code setup */
  --font-family: 'Fira Code', 'Courier New', monospace;
  --font-size-base: 14px;
  --font-size-heading: 22px;
  --font-size-name: 32px;

  /* Layout - keeping original dimensions */
  --max-width: 800px;
  --image-size: 160px;

  /* Transitions and animations - subtle improvements */
  --transition-fast: 0.2s ease-in-out;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Subtle shadows for polish */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* =============================================
   Base Styles - Enhanced with Polish
   ============================================= */

/* Links - Enhanced with subtle underline animation */
a {
  color: var(--link-color);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}

/* Subtle underline animation on hover */
a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--link-hover);
  transition: width var(--transition-smooth);
}

a:focus,
a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

a:hover::after {
  width: 100%;
}

/* Typography - Original font setup with improved spacing */
body,
td,
th,
tr,
p,
a {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5; /* Improved line spacing */
}

strong {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
}

/* Improved paragraph spacing */
p {
  margin-bottom: 0.8rem;
}

/* Custom Elements - Original styling */
heading {
  font-family: var(--font-family);
  font-size: var(--font-size-heading);
  margin-bottom: 1.2rem; /* Better spacing */
}

papertitle {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 700;
  display: block;
  margin-bottom: 0.1rem; /* Very tight spacing between title and authors */
  line-height: 1.4;
}

/* Remove spacing from br tags that come after paper titles */
papertitle + br {
  display: none; /* Hide the br tag after titles to eliminate gap */
}

name, n {
  font-family: var(--font-family);
  font-size: var(--font-size-name);
  display: block;
  margin-bottom: 1rem; /* Better spacing */
}



/* =============================================
   Image Enhancements - Subtle Shadows
   ============================================= */

/* Profile image - clean appearance */
img[style*="width:100%"] {
  border-radius: 8px; /* Gentle corner rounding */
}

/* Paper images - clean appearance */
img[width="160"], img[width="120"] {
  border-radius: 6px; /* Subtle corner rounding */
}

/* Remove styling from animated GIFs to prevent visual artifacts */
img[src*=".gif"] {
  border-radius: 0 !important; /* No rounded corners for GIFs */
}

/* Specific styling for single_chain.gif */
img[src*="single_chain.gif"] {
  transform: rotate(90deg); /* Rotate single_chain GIF 90 degrees clockwise */
  clip-path: inset(10px 10px 10px 10px); /* Crop 10px from all edges (top, right, bottom, left) */
}


/* =============================================
   Image Hover Effects - Enhanced Polish
   ============================================= */
.one {
  width: var(--image-size);
  height: var(--image-size);
  position: relative;
  border-radius: 6px; /* Consistent with image rounding */
  overflow: hidden; /* Clean edges */
}

.two {
  width: var(--image-size);
  height: var(--image-size);
  position: absolute;
  transition: opacity var(--transition-smooth); /* Smoother transition */
  border-radius: 6px;
}

.fade {
  transition: opacity var(--transition-smooth);
}

/* =============================================
   Layout Improvements - Better Spacing
   ============================================= */

/* Main container - improved spacing */
table[style*="max-width:800px"] {
  margin-top: 2rem; /* Better top spacing */
  margin-bottom: 2rem; /* Better bottom spacing */
}

/* Research section spacing */
table[style*="width:100%"] td[style*="padding:20px"] {
  padding: 0.4rem 1.5rem 1.5rem 1.5rem !important; /* Further reduced top spacing */
}

/* Consistent spacing between publication entries */
tr:has(papertitle) {
  margin-bottom: 2rem; /* Consistent spacing between papers */
}

/* Alternative approach: consistent padding on paper cells */
td[style*="padding:20px"][style*="width:25%"],
td[width="75%"]:has(papertitle) {
  padding-bottom: 2rem !important; /* Consistent bottom spacing for paper entries */
}

/* Profile section - enhanced spacing */
td[style*="width:63%"] {
  padding: 3rem 2.5% 1rem 2.5% !important; /* Reduced bottom spacing */
}

td[style*="width:40%"] {
  padding: 2rem 7.5% 1rem 7.5% !important; /* Reduced bottom spacing */
}

/* Contact links - improved spacing and subtle effects */
p[style*="text-align:center"] a {
  padding: 0.4rem 0.8rem; /* Subtle padding for better click area */
  margin: 0 0.3rem; /* Better spacing between links */
  border-radius: 4px; /* Gentle rounding */
  transition: all var(--transition-fast);
}

p[style*="text-align:center"] a:hover {
  background: rgba(23, 114, 208, 0.05); /* Very subtle background on hover */
  transform: translateY(-1px); /* Gentle lift */
}

/* =============================================
   Utility Classes
   ============================================= */
span.highlight {
  background-color: var(--highlight-bg);
  padding: 0.1rem 0.3rem; /* Better padding */
  border-radius: 3px; /* Subtle rounding */
  transition: background-color var(--transition-fast);
}

span.highlight:hover {
  background-color: #fff4a3; /* Slightly more vibrant on hover */
}

/* =============================================
   Modern Enhancements (Subtle Improvements)
   ============================================= */

/* Better font rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Better focus states for accessibility */
a:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Subtle page-level enhancements */
body {
  transition: background-color var(--transition-fast);
}

/* =============================================
   Responsive Improvements (Mobile-friendly)
   ============================================= */
@media (max-width: 768px) {
  /* Make main table responsive while keeping desktop look */
  table {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Stack profile content on mobile */
  td[style*="width:63%"] {
    width: 100% !important;
    display: block;
    padding: 2rem 2.5% !important; /* Improved mobile spacing */
  }

  td[style*="width:40%"] {
    width: 100% !important;
    display: block;
    text-align: center;
    padding: 1.5rem 2.5% !important; /* Better mobile spacing */
  }

  /* Center name on mobile */
  name, n {
    display: block;
    text-align: center;
  }

  /* Better spacing for mobile */
  p {
    margin-bottom: 1rem;
  }


}

@media (max-width: 480px) {
  /* Slightly smaller fonts on very small screens */
  :root {
    --font-size-name: 28px;
    --font-size-heading: 20px;
  }

  /* Better image sizing on small screens */
  img[style*="width:100%"] {
    max-width: 200px;
    height: auto;
  }

  /* Smaller contact link padding on mobile */
  p[style*="text-align:center"] a {
    padding: 0.3rem 0.6rem;
    margin: 0.2rem;
  }
}

/* =============================================
   Print Styles (Professional Touch)
   ============================================= */
@media print {
  body {
    font-size: 12px;
  }

  a {
    color: black !important;
    text-decoration: underline;
  }

  a::after {
    display: none; /* Hide animated underlines in print */
  }

  .two {
    display: none; /* Hide hover effects in print */
  }

  /* Remove shadows for print */
  img {
    box-shadow: none !important;
  }
}