:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --accent-color: #0ea5e9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --background-primary: #ffffff;
  --background-secondary: #f8fafc;
  --background-accent: #f1f5f9;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  background-color: var(--background-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Buttons */
.button {
  border-radius: 9999px !important;
  font-weight: 600 !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: 1.5px solid var(--border-color) !important;
  position: relative;
  overflow: hidden;
}

.button.is-dark {
  background: var(--text-primary) !important;
  border: none !important;
  color: white !important;
  box-shadow: none;
}

.button.is-dark:hover {
  transform: scale(1.05);
  background: var(--secondary-color) !important;
  box-shadow: var(--shadow-sm);
}

.button.is-dark:active {
  transform: scale(0.97);
  box-shadow: none;
}

.link-block a {
  margin: 8px 4px;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
}

.hero.is-light {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.hero-body {
  padding: 4rem 1.5rem;
}

.teaser .hero-body {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.teaser {
  font-family: 'Inter', sans-serif;
}

.teaser-figure img {
  border-radius: 0;
  box-shadow: var(--shadow-xl);
  width: 100%;
  height: auto;
}

/* Publication Styles */
.publication-title {
  font-family: 'Inter', sans-serif !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  margin-bottom: 2rem !important;
  line-height: 1.1 !important;
}

.publication-authors {
  font-family: 'Inter', sans-serif !important;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.publication-authors a {
  color: var(--primary-color) !important;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}

.publication-authors a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: var(--gradient-accent);
  transition: var(--transition);
}

.publication-authors a:hover::after {
  width: 100%;
}

.publication-authors a:hover {
  color: var(--primary-hover) !important;
}

.author-block {
  display: inline-block;
  margin-right: 0.5rem;
}

.publication-venue {
  color: var(--text-secondary);
  width: fit-content;
  font-weight: 600;
  background: var(--background-accent);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  margin: 1rem auto 0;
  display: inline-block;
}

/* Section Titles */
.title.is-3 {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700 !important;
  color: var(--text-primary);
  margin-bottom: 2rem !important;
  position: relative;
  padding-bottom: 1rem;
}

.title.is-3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

/* Content */
.content.has-text-justified {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.content.has-text-justified p {
  margin-bottom: 1.5rem;
}

/* Stat Cards */
.stat-card {
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-number.highlight {
  color: #ef4444;
}

.stat-number.accent {
  color: #10b981;
}

.stat-arrow {
  font-size: 1.5rem;
  color: #ef4444;
  margin: 0.25rem 0;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  line-height: 1.4;
}

/* Task Cards */
.task-card {
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  height: 100%;
}

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

/* Play Link */
.play-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--text-primary);
  color: white !important;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.play-link:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.play-link:active {
  transform: scale(0.97);
}

.play-link .icon {
  font-size: 0.8rem;
}

.task-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.task-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.task-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Failure Cards */
.failure-card {
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  height: 100%;
}

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

.failure-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.failure-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Theorem Box */
.theorem-box {
  background: var(--background-primary);
  border-left: 4px solid var(--primary-color);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.theorem-label {
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theorem-box p {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
  font-style: italic;
}

/* SGCoT Example */
.sgcot-video-container {
  height: 100%;
  display: flex;
  align-items: center;
}

.sgcot-video-container video {
  width: 100%;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.sgcot-example {
  background: var(--background-accent);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin: 0;
  box-shadow: var(--shadow-md);
}

.sgcot-prompt,
.sgcot-response {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.sgcot-prompt {
  background: var(--background-secondary);
  border-bottom: 1px solid var(--border-color);
}

.sgcot-response {
  background: var(--background-primary);
}

.sgcot-response code {
  font-size: 0.85rem;
  word-break: break-all;
}

.sgcot-label {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  margin-right: 0.75rem;
  vertical-align: middle;
}

.sgcot-prompt .sgcot-label {
  background: var(--primary-color);
  color: white;
}

.sgcot-response .sgcot-label {
  background: #10b981;
  color: white;
}

.sgcot-highlight {
  background: #fef3c7;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-weight: 700;
  color: #92400e;
}

.sgcot-answer {
  font-weight: 700;
  color: #10b981;
}

/* Comparison Figures */
.comparison-figure {
  overflow: hidden;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.comparison-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--border-radius);
}

/* Highlighted links in content */
.content.has-text-justified a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  font-weight: 600;
  transition: var(--transition);
}

.content.has-text-justified a:hover {
  color: var(--primary-hover);
  text-decoration-thickness: 2.5px;
}

/* BibTeX */
pre {
  background: var(--background-accent) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  padding: 1.5rem !important;
  font-size: 0.9rem !important;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

code {
  background: var(--background-accent) !important;
  color: var(--text-primary) !important;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace !important;
}

.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.copy-bibtex-btn {
  background: var(--text-primary);
  color: white;
  border: none;
  border-radius: 9999px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-bibtex-btn:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}

.copy-bibtex-btn:active {
  transform: scale(0.97);
}

.copy-bibtex-btn.copied {
  background: #10b981;
}

/* Scroll to Top */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
}

.scroll-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

/* Footer */
.footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem;
}

.footer .content {
  color: var(--text-secondary);
  line-height: 1.7;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Mobile */
@media screen and (max-width: 768px) {
  .hero-body {
    padding: 2rem 1rem;
  }

  .publication-title {
    font-size: 2rem !important;
    line-height: 1.2 !important;
    margin-bottom: 1.5rem !important;
  }

  .publication-authors {
    font-size: 1rem !important;
  }

  .button {
    margin: 0.25rem !important;
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }

  .stat-number {
    font-size: 2rem;
  }

  .content.has-text-justified {
    font-size: 1rem;
  }

  .sgcot-prompt,
  .sgcot-response {
    padding: 1rem;
    font-size: 0.85rem;
  }
}

@media screen and (max-width: 480px) {
  .publication-title {
    font-size: 1.75rem !important;
  }

  .hero-body {
    padding: 1.5rem 0.75rem;
  }

  .link-block {
    display: block;
    margin-bottom: 0.5rem;
  }

  .button {
    width: 100%;
    justify-content: center;
  }
}

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

.hero, .section {
  animation: fadeInUp 0.6s ease-out;
}

.button:focus,
a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

@media print {
  .scroll-to-top {
    display: none;
  }

  .hero, .section {
    animation: none;
  }
}
