/* Common styles for OT-MPC project pages */

:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-secondary: #555;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --code-bg: #f4f4f5;
  --section-bg: #fff;
}

[data-theme="dark"] {
  --bg: #0f0f13;
  --text: #e8e8ed;
  --text-secondary: #a0a0b0;
  --accent: #4f8ffc;
  --accent-hover: #6ba3ff;
  --border: #2a2a3e;
  --code-bg: #1a1a24;
  --section-bg: #16161d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

/* Container */
.page-wrapper {
  display: flex;
  justify-content: center;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 48px;
}

h1 {
  font-family: 'Inter', sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 28px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.authors {
  font-size: 1.15rem;
  margin-bottom: 8px;
  line-height: 1.8;
}

.authors a {
  color: var(--accent);
  text-decoration: none;
}

.authors a:hover {
  text-decoration: underline;
}

.affiliations {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  text-align: center;
}

.affiliations a {
  color: var(--text-secondary);
  text-decoration: none;
}

.affiliations a:hover {
  color: var(--accent);
}

/* Links row */
.links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--section-bg);
  color: var(--text);
  text-decoration: none;
  border-radius: 24px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.links a:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.links a svg {
  width: 18px;
  height: 18px;
}

/* Sections */
section {
  margin-bottom: 56px;
}

h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text);
}

h2::after {
  content: '';
  display: block;
  width: 80px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto 0;
}

h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 14px;
  color: var(--text);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
}

p {
  margin-bottom: 16px;
  text-align: justify;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--section-bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* Side Navigation */
.side-nav {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 180px;
  padding: 16px;
  background: var(--section-bg);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  z-index: 100;
}

.side-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-nav li {
  margin-bottom: 4px;
}

.side-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.side-nav a:hover {
  color: var(--accent);
  background: var(--code-bg);
}

.side-nav a.active {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  font-weight: 500;
}

.side-nav .nav-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-left: 12px;
}

/* Footer */
footer {
  text-align: center;
  padding: 32px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

footer a {
  color: var(--accent);
}

/* Inline math styling */
.math {
  font-family: 'Times New Roman', serif;
  font-style: italic;
}

/* Video/Demo grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 32px 0;
}

.video-item {
  background: var(--section-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.video-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.video-caption {
  padding: 16px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  background: var(--section-bg);
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

/* Experiment cards */
.experiment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.experiment-card {
  background: var(--section-bg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.experiment-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}

.experiment-card-image {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
}

.experiment-card-image.quadrotor {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.experiment-card-image.dual-quad {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.experiment-card-image.go2 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.experiment-card-content {
  padding: 20px;
}

.experiment-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.experiment-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.experiment-card-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--code-bg);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* Responsive */
@media (max-width: 1200px) {
  .side-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 1.8rem; }
  .container { padding: 32px 16px; }
  .links { flex-direction: column; align-items: center; }
  .links a { width: 100%; justify-content: center; }
  .video-grid { grid-template-columns: 1fr; }
  .experiment-grid { grid-template-columns: 1fr; }
}
