/* ===================================
   CSS Custom Properties (Variables)
   =================================== */
:root {
  /* Colors - Professional academic palette */
  --color-primary: #37474f;        /* Blue Grey 800 */
  --color-primary-dark: #263238;   /* Blue Grey 900 */
  --color-primary-light: #546e7a;  /* Blue Grey 600 */
  --color-accent: #00acc1;         /* Cyan 600 */
  --color-accent-hover: #00838f;   /* Cyan 700 */
  --color-text: #212121;           /* Almost black */
  --color-text-light: #757575;     /* Grey 600 */
  --color-background: #fafafa;     /* Grey 50 */
  --color-surface: #ffffff;        /* White */
  --color-border: #e0e0e0;         /* Grey 300 */
  
  /* Typography */
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base: 16px;
  --font-size-small: 14px;
  --font-size-large: 18px;
  --font-size-h1: 32px;
  --font-size-h2: 24px;
  --font-size-h3: 20px;
  --font-size-h4: 18px;
  --line-height-base: 1.6;
  --line-height-heading: 1.2;
  
  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  
  /* Layout */
  --max-width-content: 1200px;
  --max-width-narrow: 860px;
  --header-height: 120px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.10);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/* ===================================
   Reset & Base Styles
   =================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-sm) 0;
  line-height: var(--line-height-heading);
  font-weight: 500;
  color: var(--color-text);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }

p {
  margin: 0 0 var(--spacing-sm) 0;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

ul, ol {
  margin: 0 0 var(--spacing-sm) 0;
  padding-left: var(--spacing-md);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===================================
   Layout Structure
   =================================== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: linear-gradient(to bottom, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.site-title {
  font-size: var(--font-size-h1);
  font-weight: 300;
  color: white;
  margin: 0;
  padding: var(--spacing-md) 0 var(--spacing-sm) 0;
}

.main-content {
  flex: 1;
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-sm);
  width: 100%;
}

.site-footer {
  background: var(--color-primary-dark);
  color: white;
  text-align: center;
  padding: var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.site-footer p {
  margin: 0;
  font-size: var(--font-size-small);
  opacity: 0.8;
}

/* ===================================
   CSS-Only Tab Navigation
   =================================== */
.tab-navigation {
  position: relative;
}

/* Hide radio inputs */
.tab-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tab-labels {
  display: flex;
  gap: 0;
  background: var(--color-primary-dark);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.tab-labels::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.tab-label {
  flex: 1;
  min-width: 120px;
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  font-size: var(--font-size-small);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-bottom: 4px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

.tab-label:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Active tab styles */
#tab-contact:checked ~ .page-wrapper .tab-label[for="tab-contact"],
#tab-cv:checked ~ .page-wrapper .tab-label[for="tab-cv"],
#tab-publications:checked ~ .page-wrapper .tab-label[for="tab-publications"],
#tab-conferences:checked ~ .page-wrapper .tab-label[for="tab-conferences"],
#tab-software:checked ~ .page-wrapper .tab-label[for="tab-software"] {
  color: white;
  border-bottom-color: white;
  background: rgba(255, 255, 255, 0.15);
}

/* Tab panel visibility */
.tab-panel {
  display: none;
  animation: fadeIn var(--transition-base);
}

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

#tab-contact:checked ~ .page-wrapper .tab-panel[data-tab="contact"],
#tab-cv:checked ~ .page-wrapper .tab-panel[data-tab="cv"],
#tab-publications:checked ~ .page-wrapper .tab-panel[data-tab="publications"],
#tab-conferences:checked ~ .page-wrapper .tab-panel[data-tab="conferences"],
#tab-software:checked ~ .page-wrapper .tab-panel[data-tab="software"] {
  display: block;
}

/* ===================================
   Grid System
   =================================== */
.grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-2-col {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.grid-3-col {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ===================================
   Card Components
   =================================== */
.card {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-md);
  transition: box-shadow var(--transition-base);
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin-top: 0;
  color: var(--color-primary);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: var(--spacing-sm);
}

/* Software project cards */
.software-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
}

.card-software {
  position: relative;
  height: 256px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.card-software:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-software-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.card-software-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  z-index: 1;
}

.card-software-title {
  font-size: var(--font-size-large);
  font-weight: 500;
  margin: 0;
  color: white;
}

.card-software-description {
  font-size: var(--font-size-small);
  margin: var(--spacing-xs) 0 0 0;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-base), max-height var(--transition-base);
}

.card-software:hover .card-software-description {
  opacity: 1;
  max-height: 100px;
}

/* ===================================
   Section Styles
   =================================== */
.section {
  margin-bottom: var(--spacing-xl);
}

.section-title {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
}

.subsection {
  margin-bottom: var(--spacing-lg);
}

.subsection-title {
  color: var(--color-primary-light);
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
}

/* Profile section */
.profile-section {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr 2fr;
  align-items: stretch; /* Make items same height */
}

/* Contact tab profile section */
[data-tab="contact"] .profile-section {
  grid-template-columns: auto 1fr;
}

.profile-image {
  width: 100%;
  max-width: 450px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

/* Headshot on contact tab - fixed height for consistent sizing */
#headshot {
  height: 320px;
  width: auto;
  display: block;
}

/* PhD wrapper - special card with no padding for flush cover image */
.phd-wrapper {
  padding: 0;
  overflow: hidden;
}

.phd-wrapper .profile-section {
  gap: var(--spacing-lg);
  align-items: center; /* Center the text panel vertically with the image */
  grid-template-columns: auto 1fr; /* Image takes its natural width; text fills the rest */
}

.phd-wrapper .card {
  background: #f5f5f5; /* Slightly darker shade */
  margin-right: var(--spacing-md); /* Add margin on the right side of text panel */
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  justify-self: center; /* Center the text panel horizontally in its grid column */
  max-width: 360px; /* Constrain width so the panel doesn't fill the whole remaining space */
}

/* Publications list */
.publications-list {
  list-style: none;
  padding: 0;
  /* counter-reset is set dynamically in the template based on array length */
}

.publications-list li {
  counter-increment: publication -1; /* Decrement counter for reverse order */
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
  position: relative;
}

.publications-list li::before {
  content: counter(publication) ".";
  position: absolute;
  left: 0;
  font-weight: 500;
  color: var(--color-primary);
}

/* Style for unpublished/submitted papers */
.publications-list li.not-accepted {
  color: var(--color-text-light);
  opacity: 0.75;
}

.publications-list li.not-accepted::before {
  color: var(--color-text-light);
}

/* Additional links nested within publications */
.publications-list .additional-links {
  margin-top: 0.25rem;
  margin-bottom: 0;
  margin-left: 0;
  padding-left: var(--spacing-lg);
  list-style: none;
  font-size: 0.875em;
}

.publications-list .additional-links li {
  margin-bottom: 0.15rem;
  padding-left: 1.2em;
  position: relative;
  counter-increment: none;
}

.publications-list .additional-links li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-text-light);
  font-size: 0.9em;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
  :root {
    --font-size-h1: 24px;
    --font-size-h2: 20px;
    --font-size-h3: 18px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
  }
  
  .site-title {
    font-size: 24px;
    padding: var(--spacing-sm) 0;
  }
  
  .tab-label {
    min-width: 90px;
    padding: var(--spacing-sm);
    font-size: 12px;
  }
  
  .profile-section {
    grid-template-columns: 1fr;
  }
  
  .grid-2-col {
    grid-template-columns: 1fr;
  }
  
  .software-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: var(--spacing-md) var(--spacing-sm);
  }
  
  .card {
    padding: var(--spacing-sm);
  }
}

/* ===================================
   Utility Classes
   =================================== */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-light); }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mt-lg { margin-top: var(--spacing-lg); }

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Print styles */
@media print {
  .site-header,
  .tab-navigation,
  .site-footer {
    display: none;
  }
  
  .tab-panel {
    display: block !important;
    page-break-after: always;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid var(--color-border);
  }
}
