/* ==========================================================================
   Agentic-LWM Project Page Styling
   Clean, Publication-Grade Academic Theme with Wide-Viewport Layout
   ========================================================================== */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #475569;
  --accent-color: #0284c7;
  --accent-dark: #0369a1;
  --purple-accent: #7c3aed;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --background-primary: #ffffff;
  --background-secondary: #f8fafc;
  --background-accent: #f1f5f9;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --border-radius: 10px;
  --border-radius-lg: 14px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width-wide: 1240px;
}

html {
  scroll-behavior: smooth;
}

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

/* ==========================================================================
   Wider Container Layout Override
   ========================================================================== */
.container.is-max-widescreen,
.container.is-wide,
.container.is-max-desktop {
  max-width: var(--max-width-wide) !important;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media screen and (min-width: 1440px) {
  :root {
    --max-width-wide: 1280px;
  }
}

/* ==========================================================================
   Sticky Navigation Bar
   ========================================================================== */
.alwm-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 999;
  transition: var(--transition);
}

.alwm-nav-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alwm-nav-brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.alwm-nav-brand span {
  color: var(--primary-color);
}

.alwm-nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.alwm-nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.alwm-nav-links a:hover,
.alwm-nav-links a.is-active {
  color: var(--primary-color);
  background: var(--background-secondary);
}

.alwm-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-primary);
  cursor: pointer;
}

.alwm-progress {
  height: 2px;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.1s linear;
}

@media screen and (max-width: 768px) {
  .alwm-nav-toggle {
    display: block;
  }
  .alwm-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
  }
  .alwm-nav-links.is-open {
    display: flex;
  }
}

/* ==========================================================================
   Hero & Header Section
   ========================================================================== */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, var(--background-secondary) 100%);
  padding: 3rem 0 2rem 0;
}

.publication-title {
  font-size: 2.5rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.03em !important;
  color: var(--text-primary);
  margin-bottom: 1.25rem !important;
}

.publication-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.publication-authors {
  margin-bottom: 0.75rem;
}

.author-block {
  display: inline-block;
  margin: 0 0.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.author-block a {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: var(--transition);
}

.author-block a:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.affiliations {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.venue-badge {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary-color);
  border: 1px solid #bfdbfe;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.button.is-dark {
  background-color: var(--text-primary) !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 0.55rem 1.1rem !important;
  transition: var(--transition) !important;
  border: 1px solid transparent !important;
}

.button.is-dark:hover {
  background-color: var(--primary-color) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Teaser Architecture Section
   ========================================================================== */
.teaser-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2.5rem;
}

.teaser-figure {
  width: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
  display: block;
}

.teaser-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--border-radius);
  transition: transform 0.3s ease;
}

.teaser-caption {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 1.25rem;
  text-align: left;
}

/* ==========================================================================
   Stat Banner Row
   ========================================================================== */
.stats-banner {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 2.25rem 0;
  margin: 1.5rem 0 3rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  text-align: center;
}

.stat-item {
  padding: 0.75rem;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.1;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

@media screen and (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .stat-value {
    font-size: 1.75rem;
  }
}

/* ==========================================================================
   Section & Typography Defaults
   ========================================================================== */
.section-title {
  font-size: 1.85rem !important;
  font-weight: 800 !important;
  color: var(--text-primary);
  margin-bottom: 1.25rem !important;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

.content-block {
  margin-bottom: 3rem;
}

.prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #334155;
  text-align: justify;
}

.prose p {
  margin-bottom: 1.1rem;
}

/* ==========================================================================
   Theoretical Comparison Matrix Cards
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 1.5rem 0 2rem 0;
}

.info-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.info-card h4 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card.failure {
  border-left: 4px solid #ef4444;
}

.info-card.success {
  border-left: 4px solid #10b981;
}

.info-card ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.info-card li {
  padding: 0.35rem 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  border-bottom: 1px dashed var(--border-color);
}

.info-card li:last-child {
  border-bottom: none;
}

@media screen and (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Methodology Deep Dive Cards (4 Pillars)
   ========================================================================== */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.pillar-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.pillar-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.pillar-num {
  font-size: 2.5rem;
  font-weight: 900;
  color: #f1f5f9;
  position: absolute;
  top: 0.5rem;
  right: 1.25rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.pillar-card h4 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  position: relative;
  z-index: 1;
}

.pillar-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.pillar-card .formula {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  color: #1e293b;
  overflow-x: auto;
}

@media screen and (max-width: 768px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Interactive Rollout Gallery
   ========================================================================== */
.rollout-gallery {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

.rollout-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.rollout-item {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  text-align: center;
  transition: var(--transition);
}

.rollout-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.rollout-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.rollout-caption {
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rollout-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 0.2rem;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-green { background: #dcfce7; color: #166534; }

@media screen and (max-width: 768px) {
  .rollout-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Publication Tables (Wide & Responsive)
   ========================================================================== */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  margin: 1.5rem 0 2rem 0;
}

.alwm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.alwm-table th {
  background: var(--background-secondary);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.alwm-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: #334155;
  white-space: nowrap;
}

.alwm-table tr:last-child td {
  border-bottom: none;
}

.alwm-table tr.highlight-row {
  background: #f0fdf4;
  font-weight: 600;
}

.alwm-table tr.highlight-row td {
  color: #14532d;
}

.badge-rank {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-ours {
  background: #15803d;
  color: #ffffff;
}

/* ==========================================================================
   BibTeX Section
   ========================================================================== */
.bibtex-wrapper {
  position: relative;
  background: #0f172a;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.bibtex-wrapper pre {
  background: transparent;
  color: #e2e8f0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0;
  overflow-x: auto;
  padding: 0;
}

.copy-bibtex-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #334155;
  color: #ffffff;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-bibtex-btn:hover {
  background: #475569;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem 2rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

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