/* Base */
:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --card: #f8fafc;
  --border: #e2e8f0;
  --primary: #2563eb;
}

:root.dark {
  --bg: #0b1220;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --card: #0f172a;
  --border: #1f2937;
  --primary: #60a5fa;
}

html, body {
  margin: 0;
  padding: 0;
}
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img, video, iframe { max-width: 100%; display: block; }

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .title { text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: 0.2px; }
.logo { font-size: 20px; }

.nav-toggle { display: none; }
.nav-list { display: flex; gap: 16px; list-style: none; padding: 0; margin: 0; }
.nav-list a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 6px; }
.nav-list a:hover { background: var(--card); color: var(--text); }

.theme-toggle { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* Sections */
.section { padding: 56px 0; }
.section.alt { background: var(--card); }
.section-header { margin-bottom: 20px; }
.section h2 { margin: 0 0 6px; }
.lead { color: var(--muted); max-width: 70ch; }

.hero { padding: 72px 0; }
.cta-row { display: flex; gap: 12px; margin-top: 16px; }

.btn { display: inline-block; border: 1px solid var(--border); color: var(--text); background: transparent; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn:hover { opacity: 0.92; }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

/* Media cards */
.media-card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.media-card img, .media-card video { width: 100%; height: auto; }
.media-card figcaption { padding: 10px 12px; color: var(--muted); font-size: 14px; }

/* Paper */
.paper-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.paper-viewer iframe { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 12px; }

/* Abstract */
.abstract-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.abstract-section h2 {
  margin: 0 0 16px 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.abstract-text {
  text-align: justify;
  line-height: 1.7;
  margin: 0 0 20px 0;
  color: var(--text);
  font-size: 15px;
}

.keywords-section h3 {
  margin: 0 0 12px 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

/* Keywords */
.keywords-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.keyword-pill {
  display: inline-block;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.keyword-pill:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 18px 0; }
.site-footer p { margin: 0; color: var(--muted); font-size: 14px; }

/* A11y */
.skip-link { position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { position: static; width: auto; height: auto; background: var(--primary); color: #fff; padding: 6px 10px; border-radius: 8px; }

/* Methodology Section Styles */
.methodology-summary {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.methodology-summary h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.5rem;
}

.innovation-card {
  background: var(--bg);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.innovation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.innovation-card h4 {
  margin: 0 0 0.75rem 0;
  color: var(--text);
  font-size: 1.1rem;
}

.innovation-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Key points list styling */
.key-points {
  margin: 1rem 0;
  padding-left: 0;
  list-style: none;
}

.key-points li {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text);
}

.key-points li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

/* Detailed Methodology Page Styles */
.methodology-content {
  max-width: 900px;
  margin: 0 auto;
}

.methodology-content h1 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.methodology-content .lead {
  font-size: 1.2rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 2rem;
  font-weight: 500;
}

.methodology-content h2 {
  font-size: 1.8rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.methodology-content h3 {
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.methodology-content code {
  background: var(--card);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.methodology-content ol {
  padding-left: 1.5rem;
}

.methodology-content ol li {
  margin: 0.5rem 0;
  color: var(--text);
}

.active {
  font-weight: 600;
  color: var(--primary) !important;
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.methodology-actions {
  text-align: center;
  margin-top: 1rem;
}

/* Results Section Styles */
.results-overview {
  margin: 2rem 0;
  padding: 2rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.results-overview h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.5rem;
}

.metric-card {
  background: var(--bg);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metric-card h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.5rem 0;
}

.metric-card p {
  margin: 0.75rem 0 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.results-section {
  margin: 3rem 0;
}

.results-section h3 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.results-highlight {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--primary)10, var(--card));
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}

.results-highlight p {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.results-summary {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.results-summary h3 {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1.5rem;
}

.results-conclusion {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  font-style: italic;
  text-align: center;
  color: var(--text);
  border: 1px solid var(--border);
}

/* Classification Performance Visualization */
.image-container {
  text-align: center;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.methodology-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin: 0 auto 0.5rem auto;
}

.image-caption {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.5rem 0 0 0;
  line-height: 1.4;
}

.command-examples {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.command-examples h4 {
  margin: 1.5rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

.command-examples h4:first-child {
  margin-top: 0;
}

.command-examples .key-points li {
  padding: 0.3rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #22c55e;
  margin: 0.5rem 0;
  padding-left: 1rem;
  border-radius: 0 4px 4px 0;
}

.command-examples h4:nth-of-type(2) + .key-points li {
  background: rgba(251, 146, 60, 0.1);
  border-left-color: #fb923c;
}

.command-examples .results-highlight {
  margin: 1rem 0;
  background: rgba(239, 68, 68, 0.1);
}

.command-examples .results-highlight p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.command-examples .results-highlight p:first-child {
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

/* Enhanced grid layout for classification results */
.grid.two > div h4 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Waypoint Analysis Table */
.waypoint-table-container {
  margin: 2rem 0;
  overflow-x: auto;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.waypoint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 700px;
}

.waypoint-table th {
  background: var(--primary);
  color: white;
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.waypoint-table th:first-child {
  border-top-left-radius: 12px;
}

.waypoint-table th:last-child {
  border-top-right-radius: 12px;
}

.waypoint-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.waypoint-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

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

.waypoint-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}

.waypoint-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* Highlight the offset distance column */
.waypoint-table td:last-child {
  font-weight: 600;
  color: var(--primary);
  text-align: center;
}

/* Color coding for offset distances */
.waypoint-table tbody tr td:last-child {
  background: rgba(34, 197, 94, 0.1);
}

/* Responsive table adjustments */
@media (max-width: 760px) {
  .waypoint-table-container {
    margin: 1.5rem -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .waypoint-table {
    font-size: 0.8rem;
    min-width: 600px;
  }
  
  .waypoint-table th,
  .waypoint-table td {
    padding: 0.5rem 0.4rem;
  }
  
  .waypoint-table th {
    font-size: 0.75rem;
  }
  
  .waypoint-table td {
    font-size: 0.75rem;
  }
}

/* Mobile nav */
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
  .nav-list { display: none; position: absolute; right: 16px; top: 56px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px; width: calc(100% - 32px); }
  .nav-list.open { display: block; }
  .nav-list li { margin: 6px 0; }

  .command-examples {
    padding: 1rem;
  }
  
  .command-examples .key-points li {
    font-size: 0.8rem;
    padding-left: 0.8rem;
  }
  
  .image-container {
    padding: 0.75rem;
  }
}
