/* Modern CSS Variables for consistent theming */
:root {
  --primary-color: #2774AE;
  --primary-hover: #1F5F8F;
  --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, #FFD100 0%, #FFD100 100%);
  --gradient-subtle: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: system-ui, 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;
}

/* Modern Button Styles */
.button {
  border-radius: var(--border-radius) !important;
  font-weight: 600 !important;
  transition: var(--transition) !important;
  border: 2px solid transparent !important;
  position: relative;
  overflow: hidden;
}

/* Hero Section Modernization */
.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;
}

/* Publication Content Styling */

/* Modern Video and Carousel Styling */

/* Pagination and Misc Improvements */

/* Section Titles */
.title.is-3 {
  font-family: system-ui, 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 Improvements */
.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;
}

/* Footer Improvements */
.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;
}

/* BibTeX Styling */
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 Section Improvements */

/* Scroll to Top Button */

/* More Works Dropdown */

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

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

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

@media screen and (max-width: 480px) {

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

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

/* Tablet Responsive */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .hero-body {
    padding: 3rem 2rem;
  }

}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

/* Improved focus states for accessibility */
.button:focus,
a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.crest-page button:focus-visible {
  outline: 3px solid #2774ae;
  outline-offset: 4px;
}

/* Print styles */
@media print {

  .hero, .section {
    animation: none;
  }
  
  .button {
    background: transparent !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
  }
}

/* CREST page additions.
   Keep this section as overrides on top of the Academic Project Page Template CSS. */

.crest-page section[id] {
  scroll-margin-top: 4.5rem;
}

.crest-page .hero-white {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}

.crest-page .crest-hero .hero-body {
  padding: 6rem 1.5rem 6.5rem;
}

.crest-page .hero-title-dark {
  color: #363636;
  font-family: system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 1rem;
}

.crest-page .hero-subtitle-dark {
  color: #4a4a4a;
  font-weight: 400;
  line-height: 1.45;
  margin: 0 auto 2rem;
  max-width: 920px;
}

.crest-page .hero-meta p {
  color: #666;
  margin-bottom: 0;
}

.crest-page .hero-summary {
  color: #4a4a4a;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 1.4rem auto 0;
  max-width: 780px;
}

.crest-page .hero-buttons {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.crest-page .hero-buttons .button {
  margin: 0 !important;
  min-width: 0;
  width: auto;
  height: 2.25rem;
  padding: 0.45rem 1rem !important;
  font-size: 0.9rem !important;
}

.hero-buttons > :first-child { justify-self: end; }
.hero-buttons > :last-child { justify-self: start; }
.hero-buttons svg { width: 1em; height: 1em; margin-right: .45em; }

@media (max-width: 32rem) {
  .crest-page .hero-buttons { grid-template-columns: 1fr; }
  .hero-buttons > :first-child, .hero-buttons > :last-child { justify-self: center; }
}

.crest-page .hero-buttons .button.is-primary {
  background: #2774AE !important;
  border: none !important;
  color: #fff !important;
}

.crest-page .hero-buttons .button.is-primary:hover {
  background: #1F5F8F !important;
}

.crest-page .nav-sticky {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
}

.crest-page .nav-sticky.visible {
  display: block;
}

.crest-page .nav-brand {
  color: #363636;
  font-size: 1.2rem;
  font-weight: 700;
}

.crest-page #abstract .content.has-text-justified {
  font-size: 1rem;
  line-height: 1.6;
}

.crest-page .section-tint,
.crest-page .section.hero.is-light {
  background: #fafafa;
}

.crest-page .section-heading {
  margin-bottom: 2rem;
}

.crest-page .section-heading .subtitle {
  color: #4a4a4a;
  line-height: 1.45;
  margin-top: 0.35rem;
}

.crest-page .content p,
.crest-page .case-summary p {
  text-align: justify;
}

.crest-page .system-copy {
  margin: 0 auto 2rem;
  max-width: 900px;
}

.crest-page .system-workflow-copy {
  margin-top: 1.75rem;
}

.crest-page .case-summary h3 {
  color: #363636;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.crest-page .case-summary p {
  color: #4a4a4a;
  line-height: 1.65;
}

.crest-page .paper-figure {
  margin: 0;
  min-width: 0;
}

.crest-page .figure-scroll {
  overflow-x: auto;
}

.crest-page .figure-scroll img {
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 100%;
}

.crest-page figcaption {
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.45;
  margin-top: 0.75rem;
  text-align: center;
}

.crest-page .results-container {
  max-width: 1180px;
}

.crest-page .result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 0 auto 2.25rem;
}

.crest-page .result-tab {
  align-items: center;
  background: #f5f7fb;
  border: 1px solid #d7dee9;
  border-radius: 999px;
  color: #263346;
  cursor: pointer;
  display: inline-flex;
  gap: 0.55rem;
  font: inherit;
  font-weight: 700;
  min-height: 3rem;
  padding: 0.7rem 1.05rem 0.7rem 0.7rem;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.crest-page .result-tab.is-active,
.crest-page .result-tab[aria-selected="true"] {
  background: #2774AE;
  border-color: #2774AE;
  box-shadow: 0 8px 18px rgba(39, 116, 174, 0.24);
  color: #fff;
}

.crest-page .case-tab-index {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: #2774AE;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  height: 2rem;
  justify-content: center;
  min-width: 2.35rem;
}

.crest-page .result-tab.is-active .case-tab-index,
.crest-page .result-tab[aria-selected="true"] .case-tab-index {
  color: #2774AE;
}

.crest-page .case-tab-title {
  line-height: 1.1;
}

.crest-page .case-panel {
  margin: 0 auto 1rem;
  max-width: 1120px;
}

.crest-page.tabs-enabled .result-panel {
  display: none;
}

.crest-page.tabs-enabled .result-panel.is-active {
  display: block;
}

.crest-page .case-summary {
  margin: 0 auto 1.35rem;
  max-width: 940px;
}

.crest-page .case-label {
  color: #2774AE;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.crest-page .case-evidence {
  display: block;
  gap: 1rem;
  margin: 1.5rem auto 1.85rem;
  max-width: 940px;
}

.crest-page .finding-card {
  background: #f6f9ff;
  border: 1px solid #dbe7f7;
  border-left: 4px solid #2774AE;
  border-radius: 8px;
  color: #263346;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
}

.crest-page .finding-card span {
  color: #2774AE;
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.crest-page .finding-card p {
  color: #263346;
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
}

.crest-page .metric-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.crest-page .metric-card {
  background: #f7faff;
  border: 1px solid #dbe7f7;
  border-radius: 8px;
  padding: 1rem;
}

.crest-page .metric-card strong {
  color: #2774AE;
  display: block;
  font-size: 1.45rem;
  line-height: 1.1;
  margin-bottom: 0.45rem;
}

.crest-page .metric-card span {
  color: #4a4a4a;
  display: block;
  font-size: 0.88rem;
  line-height: 1.45;
}

.crest-page .case-figure {
  margin-top: 1.5rem;
  min-width: 0;
}

.crest-page .case-figure-frame {
  align-items: center;
  background: #fff;
  border: 1px solid #e1e6ef;
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: center;
  max-width: 100%;
  min-height: 390px;
  min-width: 0;
  padding: 1rem;
}

.crest-page .case-figure-frame img {
  max-height: 430px;
  object-fit: contain;
  width: auto;
}

.crest-page #result-schedule .case-figure {
  margin-left: auto;
  margin-right: auto;
  max-width: 760px;
}

.crest-page #result-schedule .case-figure-frame {
  min-height: 340px;
}

.crest-page #result-schedule .case-figure-frame img {
  max-height: 310px;
}

@media screen and (max-width: 768px) {
  .crest-page .crest-hero .hero-body {
    padding: 4rem 1rem;
  }

  .crest-page .hero-title-dark {
    font-size: 2.8rem !important;
  }

  .crest-page .hero-subtitle-dark {
    font-size: 1.45rem !important;
  }

  .crest-page .result-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .crest-page .result-tabs::-webkit-scrollbar {
    display: none;
  }

  .crest-page .result-tab {
    flex: 0 0 auto;
    max-width: 74vw;
    white-space: normal;
  }

  .crest-page .case-evidence,
  .crest-page .metric-grid {
    grid-template-columns: 1fr;
  }

  .crest-page .case-figure-frame {
    display: block;
    min-height: 0;
    width: 100%;
  }

  .crest-page .figure-scroll img {
    max-width: none;
    width: 760px;
  }

  .crest-page #motivation .figure-scroll img {
    width: 100%;
    max-width: 100%;
  }

  .crest-page #result-schedule .figure-scroll img {
    max-height: none;
    max-width: 100%;
    width: 100%;
  }

  .crest-page #result-schedule .case-figure-frame {
    min-height: 0;
  }
}

@media screen and (max-width: 420px) {
  .crest-page .hero-title-dark {
    font-size: 2.35rem !important;
  }
}

.crest-page .project-nav {
  display: flex;
  align-items: center;
  gap: clamp(.6rem, 2vw, 1.5rem);
  padding: .7rem 1rem;
}
.project-nav .nav-brand { margin-right: auto; }
.project-nav a { color: #205e8f; }
@media (max-width: 48rem) {
  .project-nav .section-link { display: none; }
  .crest-page .project-nav { font-size: .9rem; }
}

.capability-list > div {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 3fr;
  gap: 1.5rem;
  border-top: 1px solid #dce2e7;
  padding: 1rem 0;
}
.capability-list dt { font-weight: 650; }
.capability-list dd { margin: 0; }
@media (max-width: 40rem) {
  .capability-list > div { grid-template-columns: 1fr; gap: .25rem; }
}

.citation-divider {
  width: 60px;
  height: 3px;
  margin: 0 auto 2rem;
  border: 0;
  border-radius: 2px;
  background: var(--gradient-accent);
}
