/* Modern Enhancements */

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

/* Remove any remaining header borders globally */
header[role=banner] {
  border: none !important;
  border-bottom: none !important;
}

/* Enhanced focus states for accessibility */
*:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Enhanced menu responsiveness */
@media (max-width: 768px) {
  .container_16 {
    width: calc(100% - 24px);
    margin: 0 12px;
  }
  
  .menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: calc(100% - 24px);
    margin: 0 12px 16px 12px;
    padding: 8px;
  }
  
  .menu > li {
    float: none;
    display: inline-flex;
    width: auto;
    text-align: center;
    margin: 2px 4px;
  }
  
  .menu > li > a {
    display: block;
    width: auto;
    text-align: center;
    padding: 8px 12px;
    margin: 0;
    white-space: nowrap;
    font-size: 14px;
  }
  
  .theme-toggle-wrapper {
    float: none !important;
    width: auto;
    text-align: center;
    margin: 2px 4px;
  }
  
  #theme-toggle {
    padding: 8px;
    margin: 0;
  }
  
  header[role=banner] {
    text-align: center;
    padding: 24px 12px;
    border-bottom: none !important;
  }
  
  header hgroup {
    float: none;
    padding: 16px 0 0 0;
    text-align: center;
  }
  
  header figure {
    float: none;
    margin: 0 auto 16px auto;
    display: block;
    text-align: center;
  }

  /* Mobile research papers layout */
  .ref {
    margin-bottom: 12px;
    padding: 8px 12px 8px 12px;
  }

  .ref .thumb {
    float: none;
    text-align: center;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
  }

  .ref .thumb img,
  .ref .thumb-media {
    width: 80px;
  }

  .ref_text {
    text-align: left;
    min-height: auto;
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  .container_16 {
    width: calc(100% - 16px);
    margin: 0 8px;
  }
  
  .menu {
    width: calc(100% - 16px);
    margin: 0 8px 12px 8px;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }
  
  .menu > li {
    display: inline-flex;
    width: auto;
    margin: 1px 2px;
  }
  
  .menu > li > a {
    width: auto;
    padding: 6px 8px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .menu img {
    width: 18px;
    height: 18px;
  }
  
  .theme-toggle-wrapper {
    width: auto;
    margin: 1px 2px;
  }
  
  #theme-toggle {
    padding: 6px;
  }
  
  #theme-toggle svg {
    width: 16px;
    height: 16px;
  }
  
  header[role=banner] {
    padding: 16px 8px;
  }
  
  .ref {
    padding: 10px;
    margin-bottom: 10px;
  }
}

/* Very small screens - still horizontal but ultra-compact */
@media (max-width: 360px) {
  .menu {
    padding: 4px;
    width: calc(100% - 12px);
    margin: 0 6px 8px 6px;
  }
  
  .menu > li {
    margin: 1px 1px;
  }
  
  .menu > li > a {
    padding: 5px 6px;
    font-size: 12px;
  }
  
  .menu img {
    width: 16px;
    height: 16px;
  }
  
  #theme-toggle {
    padding: 5px;
  }
  
  #theme-toggle svg {
    width: 14px;
    height: 14px;
  }
  
  .container_16 {
    width: calc(100% - 12px);
    margin: 0 6px;
  }
}

/* Enhanced paper reference grid */
@media (min-width: 1024px) {
  .research-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  
  .research-grid .ref {
    margin-bottom: 0;
  }
}

/* Loading animation for images */
.thumb img,
.thumb-media {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Gradient text effect for headers */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Enhanced news section */
section[role=main] ul li {
  padding: 8px 12px;
  margin-bottom: 4px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--accent-primary);
  transition: all 0.3s ease;
  line-height: 1.4;
}

section[role=main] ul li:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-light);
}

/* Enhanced contact info styling */
.mail a {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  display: inline-block;
}

.mail a:hover {
  background: var(--accent-primary);
  color: var(--menu-text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* Theme transition */
* {
  transition-property: background-color, border-color, color, fill, stroke, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Print styles */
@media print {
  .menu,
  #theme-toggle {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .ref {
    break-inside: avoid;
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}
