/* Modern Theme - Karl Roush Portfolio */

/* ==================== CSS Custom Properties ==================== */
:root {
  /* Primary Colors */
  --color-deep-space: #0A1628;
  --color-steel-blue: #2A4A6E;
  --color-horizon: #3D5A80;
  --color-sky: #5B8AC4;
  --color-celestial: #7FA4C9;

  /* Accents */
  --color-sunset: #E07A5F;
  --color-sunrise: #F2A664;

  /* Neutrals */
  --color-frost: #F8F9FA;
  --color-mist: #E8ECEF;
  --color-slate: #6C7A89;
  --color-graphite: #343A40;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-horizon) 0%, var(--color-sky) 100%);
  --gradient-warm: linear-gradient(135deg, var(--color-sunset) 0%, var(--color-sunrise) 100%);
  --gradient-hero: linear-gradient(135deg, var(--color-deep-space) 0%, var(--color-steel-blue) 100%);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(10, 22, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(10, 22, 40, 0.12);
  --shadow-lg: 0 8px 24px rgba(10, 22, 40, 0.16);
  --shadow-xl: 0 16px 48px rgba(10, 22, 40, 0.2);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
}

/* ==================== Typography Improvements ==================== */
body {
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(3rem, 8vw, 6rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

/* ==================== Hero/About Section ==================== */
section#about {
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
}

section#about::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(91, 138, 196, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(224, 122, 95, 0.1) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, 20px); }
}

section#about::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: linear-gradient(to bottom, transparent 0%, rgba(248, 249, 250, 0.3) 40%, rgba(248, 249, 250, 0.7) 70%, #fff 100%);
  pointer-events: none;
  z-index: 3;
}

section#about .resume-section-content {
  position: relative;
  z-index: 1;
}

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

h1.hero-name {
  animation: fadeInUp 0.8s ease-out 0.2s both;
  color: white;
}

h1.hero-name .text-phd {
  -webkit-text-fill-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.5);
}

h1.hero-name .text-primary2 {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  animation: fadeInUp 0.8s ease-out 0.4s both;
  color: rgba(255, 255, 255, 0.95);
}

section#about .lead {
  animation: fadeInUp 0.8s ease-out 0.6s both;
  color: rgba(255, 255, 255, 0.85);
}

section#about .social-icons {
  animation: fadeInUp 0.8s ease-out 0.8s both;
}

section#about .social-icon {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  transition: all var(--transition-spring);
  position: relative;
  overflow: hidden;
}

section#about .social-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-warm);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

section#about .social-icon:hover {
  transform: translateY(-5px) scale(1.1);
  border-color: var(--color-sunset);
  box-shadow: 0 8px 24px rgba(224, 122, 95, 0.4);
}

section#about .social-icon:hover::before {
  opacity: 1;
}

section#about .subheading a {
  color: var(--color-celestial) !important;
  transition: color var(--transition-fast);
}

section#about .subheading a:hover {
  color: var(--color-sunrise) !important;
}

section#about .github-link {
  color: var(--color-celestial) !important;
  font-style: italic;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--color-celestial);
  transition: all var(--transition-fast);
  padding-bottom: 2px;
}

section#about .github-link:hover {
  color: var(--color-sunrise) !important;
  border-bottom-color: var(--color-sunrise);
}

section#about .subheading {
  color: rgba(255, 255, 255, 0.8);
}

/* (grid overlay moved to ::before, ::after used for hero fade) */

/* Remove hard hr line between about and experience */
section#about + hr {
  display: none;
}

/* ==================== Experience Timeline ==================== */
.timeline {
  position: relative;
  padding-left: var(--space-4xl);
  margin-top: var(--space-3xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--space-xl) + 1.5rem);
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--color-sky) 0%,
    var(--color-horizon) 50%,
    var(--color-steel-blue) 100%
  );
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-4xl);
  opacity: 0;
}

.timeline-item.is-visible {
  animation: fadeInLeft 0.6s ease-out forwards;
}

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

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-4xl) + var(--space-xl));
  top: var(--space-sm);
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  background: white;
  border: 3px solid var(--color-sky);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all var(--transition-spring);
}

.timeline-dot i {
  font-size: 1.2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all var(--transition-spring);
}

.timeline-dot-img {
  width: 1.4rem;
  height: 1.4rem;
  object-fit: contain;
  transition: all var(--transition-spring);
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.2);
  border-color: var(--color-sunset);
  box-shadow: 0 0 0 8px rgba(91, 138, 196, 0.2);
}

.timeline-item:hover .timeline-dot i {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
  transform: scale(1.15);
}

.timeline-item:hover .timeline-dot-img {
  transform: scale(1.15);
}

.timeline-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-mist);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.timeline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--transition-spring);
}

.timeline-item:hover .timeline-card {
  transform: translateX(10px);
  box-shadow: var(--shadow-xl);
}

.timeline-item:hover .timeline-card::before {
  transform: scaleY(1);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.timeline-title {
  flex: 1;
}

.timeline-title h3 {
  margin-bottom: var(--space-sm);
  color: var(--color-deep-space);
}

.timeline-company {
  color: var(--color-sky);
  transition: color var(--transition-fast);
}

.timeline-company:hover {
  color: var(--color-sunset);
}

.timeline-date {
  background: var(--gradient-primary);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.timeline-content ul {
  list-style: none;
  padding: 0;
}

.timeline-content li {
  position: relative;
  padding-left: var(--space-xl);
  margin-bottom: var(--space-xs);
  color: var(--color-slate);
  line-height: 1.6;
}

.timeline-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-sky);
}

/* ==================== Projects Section ==================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-2xl);
  margin-top: var(--space-3xl);
}

.project-card {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
  border: 1px solid var(--color-mist);
  opacity: 0;
}

.project-card.is-visible {
  animation: fadeInUp 0.6s ease-out forwards;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-spring);
  z-index: 2;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-sky);
}

.project-header {
  padding: var(--space-xl);
  background: var(--color-deep-space);
  color: white;
  position: relative;
  overflow: hidden;
}

.project-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.project-card:hover .project-header::after {
  opacity: 1;
}

.project-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5em;
  position: relative;
  z-index: 1;
}

.project-title a {
  color: white;
  text-decoration: none;
  transition: color var(--transition-fast);
  margin: 0;
}

.project-title a:first-child {
  flex: 1;
}

.project-title a:hover {
  color: var(--color-sunrise);
}

.project-link-icon {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-link-icon svg {
  width: 0.75em;
  height: 0.75em;
  opacity: 0.6;
  transition: all var(--transition-fast);
  color: white;
}

.project-link-icon:hover svg {
  opacity: 1;
  color: var(--color-sunrise);
}

.project-body {
  padding: var(--space-xl);
}

.project-highlights {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-highlights li {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
  position: relative;
  color: var(--color-graphite);
  font-size: 0.875rem;
}

.project-highlights li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--color-sky);
  font-weight: bold;
}

/* ==================== Navigation Enhancements ==================== */
#sideNav {
  background: var(--gradient-hero);
}

#sideNav .navbar-brand h4 {
  color: white;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#sideNav .navbar-brand .img-profile {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.nav-link {
  position: relative;
  transition: all var(--transition-base);
}

.nav-link::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: var(--gradient-warm);
  border-radius: var(--radius-sm);
  transition: height var(--transition-spring);
}

.nav-link.active::before,
.nav-link:hover::before {
  height: 70%;
}

/* ==================== Section Backgrounds ==================== */
/* Remove max-width from sections so backgrounds extend full viewport width */
section.resume-section {
  max-width: none !important;
}

section.resume-section .resume-section-content {
  max-width: 75rem;
}

section.resume-section:nth-of-type(even):not(#about) {
  background-color: var(--color-frost);
}

/* Smoother section headings */
.resume-section h2 {
  color: var(--color-deep-space);
  position: relative;
  display: inline-block;
}

.resume-section h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-warm);
  border-radius: var(--radius-full);
}

/* ==================== Education Section ==================== */
.education-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.education-card {
  display: flex;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-mist);
  overflow: hidden;
  transition: all var(--transition-slow);
  opacity: 0;
}

.education-card.is-visible {
  animation: fadeInUp 0.6s ease-out forwards;
}

.education-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-sky);
}

.education-card-accent {
  width: 5px;
  flex-shrink: 0;
  background: var(--gradient-primary);
}

.education-card:hover .education-card-accent {
  background: var(--gradient-warm);
}

.education-card-content {
  flex: 1;
  padding: var(--space-xl) var(--space-2xl);
}

.education-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.education-card-header h3 {
  color: var(--color-deep-space);
}

.education-school {
  color: var(--color-sky);
  font-weight: 600;
  font-size: 1.05rem;
  margin-top: var(--space-xs);
}

.education-icon {
  font-size: 1.5rem;
  color: var(--color-mist);
  transition: all var(--transition-spring);
  flex-shrink: 0;
  margin-left: var(--space-lg);
}

.education-card:hover .education-icon {
  color: var(--color-sky);
  transform: scale(1.1);
}

.education-card-body {
  color: var(--color-slate);
  line-height: 1.7;
}

#education h3 {
  color: var(--color-deep-space);
}

/* ==================== Volunteering Section ==================== */
#involvement .subheading {
  color: var(--color-deep-space);
}

/* ==================== Footer ==================== */
.site-footer {
  background: var(--gradient-hero);
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
}

@media (min-width: 992px) {
  .site-footer {
    padding-left: 17rem;
  }
}

.footer-content {
  max-width: 75rem;
  margin: 0 auto;
}

.footer-back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  margin-bottom: var(--space-xl);
  transition: all var(--transition-spring);
}

.footer-back-to-top:hover {
  background: var(--gradient-warm);
  border-color: var(--color-sunset);
  transform: translateY(-4px);
  color: white;
  text-decoration: none;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer-social a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.footer-social a:hover {
  color: white;
  transform: translateY(-2px);
}

.footer-text {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  margin: 0;
}

/* ==================== Links ==================== */
section:not(#about) a:not(.social-icon):not(.nav-link):not(.timeline-company):not(.navbar-brand) {
  color: var(--color-sky);
  transition: color var(--transition-fast);
}

section:not(#about) a:not(.social-icon):not(.nav-link):not(.timeline-company):not(.navbar-brand):hover {
  color: var(--color-sunset);
}

/* ==================== Skills Section ==================== */
.dev-icons i {
  display: inline-block;
  transition: all var(--transition-spring);
}

.dev-icons i:hover {
  transform: scale(1.2) rotate(5deg);
  color: var(--color-sky);
}

/* ==================== Dark Mode ==================== */

/* Dark mode color overrides */
[data-theme="dark"] {
  --color-deep-space: #0A1628;
  --color-frost: #121c2e;
  --color-mist: #1a2a44;
  --color-slate: #a0aec0;
  --color-graphite: #cbd5e0;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Base elements */
[data-theme="dark"] body {
  background-color: #0e1726;
  color: #cbd5e0;
}

[data-theme="dark"] hr {
  border-color: #1e3050;
}

/* Section backgrounds */
[data-theme="dark"] section.resume-section:not(#about) {
  background-color: #0e1726;
}

[data-theme="dark"] section.resume-section:nth-of-type(even):not(#about) {
  background-color: #0a1220;
}

[data-theme="dark"] section#about::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(14, 23, 38, 0.3) 40%,
    rgba(14, 23, 38, 0.7) 70%,
    #0e1726 100%
  );
}

/* Typography */
[data-theme="dark"] .resume-section h2,
[data-theme="dark"] .resume-section h3,
[data-theme="dark"] .timeline-title h3,
[data-theme="dark"] .education-card-header h3,
[data-theme="dark"] #education h3,
[data-theme="dark"] #involvement .subheading,
[data-theme="dark"] .subheading {
  color: #e2e8f0;
}

[data-theme="dark"] .timeline-content li,
[data-theme="dark"] .project-highlights li,
[data-theme="dark"] .education-card-body,
[data-theme="dark"] #skills .col-sm,
[data-theme="dark"] #involvement p,
[data-theme="dark"] #involvement br + * {
  color: #a0aec0;
}

[data-theme="dark"] .text-warning {
  color: var(--color-sunrise) !important;
}

/* Cards */
[data-theme="dark"] .timeline-card,
[data-theme="dark"] .project-card,
[data-theme="dark"] .education-card,
[data-theme="dark"] .project-body {
  background: #162033;
  border-color: #1e3050;
}

[data-theme="dark"] .timeline-card:hover,
[data-theme="dark"] .project-card:hover,
[data-theme="dark"] .education-card:hover {
  border-color: var(--color-sky);
}

[data-theme="dark"] .project-header {
  background: #0c1322;
}

[data-theme="dark"] .timeline-dot {
  background: #1a2a44;
  border-color: var(--color-sky);
}

/* Education section */
[data-theme="dark"] .education-school {
  color: var(--color-celestial);
}

[data-theme="dark"] .education-icon {
  color: #2a4060;
}

[data-theme="dark"] .education-card:hover .education-icon {
  color: var(--color-sky);
}

/* Dark mode toggle button */
.dark-mode-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1100;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--color-deep-space);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-spring);
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-sky);
}

.dark-mode-toggle .fa-sun {
  display: none;
}

[data-theme="dark"] .dark-mode-toggle .fa-sun {
  display: inline;
}

[data-theme="dark"] .dark-mode-toggle .fa-moon {
  display: none;
}

/* ==================== Accessibility ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== Responsive Adjustments ==================== */
@media (max-width: 767px) {
  .timeline {
    padding-left: 3.5rem;
  }

  .timeline::before {
    left: 1rem;
  }

  .timeline-dot {
    left: -3.5rem;
    width: 2rem;
    height: 2rem;
  }

  .timeline-dot i {
    font-size: 0.85rem;
  }

  .timeline-dot-img {
    width: 1rem;
    height: 1rem;
  }

  .timeline-header {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .timeline-date {
    align-self: flex-start;
  }

  .timeline-card {
    padding: var(--space-md) var(--space-lg);
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  h1 {
    font-size: clamp(2rem, 8vw, 4rem);
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
