/* Base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', Arial, Helvetica, sans-serif;
  background: #fff;
  color: #111;
}

.frame {
  margin: 0 auto;
  max-width: 700px;
  min-height: 100vh;
  background: #fff;
  padding: 0;
  box-sizing: border-box;
  position: relative;
}

/* Header - full width liquid glass */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  z-index: 1000;
  transition: all 0.3s ease;
  pointer-events: none;
}

.header-content,
.header-content * {
  pointer-events: auto;
}

.header-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  transition: all 0.3s ease;
  z-index: 1;
}

/* Scrolled state - show liquid glass effect */
.header.scrolled .header-container {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.08);
}

.header.scrolled .glass-container {
  opacity: 1;
}

.glass-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glass-effect-backdrop {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.glass-effect {
  position: absolute;
  -webkit-backdrop-filter: url(#distortion);
  backdrop-filter: url(#distortion);
}

.glass-effect.top,
.glass-effect.bottom,
.glass-effect.left,
.glass-effect.right {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.glass-container,
.glass-effect,
.glass-effect-backdrop {
  pointer-events: none;
}

.header-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 20px 40px;
  font-size: 18px;
  font-weight: 400;
  width: 700px;
  max-width: 700px;
  margin: 0 auto;
  box-sizing: border-box;
  gap: 12px;
}

.logo {
  font-weight: 500;
  font-size: 20px;
  display: flex;
  align-items: center;
  line-height: 1;
  color: #000;
  letter-spacing: -0.5px;
}

.github-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #000;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.github-link:hover {
  transform: rotate(5deg) scale(1.1);
}

.github-link svg {
  height: 1.3em;
  width: 1.7em;
  vertical-align: middle;
  display: inline-block;
}

/* Main content */
main {
  padding: 100px 48px 0 48px;
}

.intro {
  margin-top: 54px;
  margin-bottom: 45px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.intro h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 38px;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 18px;
  text-align: center;
  width: auto;
  display: block;
}

/* Dotted contour around highlight */
.rethink-highlight {
  position: relative;
  padding: 2px 8px;
  margin: 0 2px;
  display: inline-block;
  white-space: nowrap;
  font-style: italic;
}

.rethink-highlight::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px dotted #999;
  border-radius: 4px;
}

.subtitle {
  font-size: 17px;
  margin: 0;
  color: #222;
  opacity: 0.8;
  line-height: 1.5;
  font-weight: 300;
  text-align: center;
  width: 100%;
}

/* Supports Section */
.supports-section {
  margin-top: 36px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.supports-label {
  font-size: 13px;
  color: #888;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: lowercase;
}

.supports-scroll-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(
    to right,
    transparent,
    black 20%,
    black 80%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    black 20%,
    black 80%,
    transparent
  );
}

.supports-scroll {
  display: flex;
  gap: 40px;
  animation: scroll 20s linear infinite;
  width: fit-content;
}

.support-org {
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  letter-spacing: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.divider {
  border: none;
  border-top: 1px solid #eaeaea;
  margin: 48px 0;
}

.project {
  margin-bottom: 48px;
}

.project-index {
  color: #999;
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 2px;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  z-index: 999;
  flex-wrap: wrap;
  gap: 10px;
}

.header-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 0;
  letter-spacing: -0.3px;
}

/* Learn More Button */
.button-11 {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 6px 14px;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  border-radius: 6px;
  color: #3D3D3D;
  background: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  text-decoration: none;
}

.button-11:hover {
  background: #fafafa;
  border-color: #ddd;
}

.button-11:focus {
  box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 3px rgba(58, 108, 217, 0.15);
  outline: 0;
}

.button-11 svg {
  display: inline-block;
  vertical-align: middle;
  height: 0.9em;
  width: 0.9em;
  margin-left: 6px;
}

/* Hero Visual / Route Animation */
.hero-visual {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.route-animation {
  width: 100%;
  height: 100%;
  position: relative;
}

.depot {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #000;
  border-radius: 3px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.stop {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #4CAF50;
  border-radius: 50%;
  z-index: 5;
}

.stop-1 { top: 30%; left: 20%; background: #4CAF50; }
.stop-2 { top: 70%; left: 15%; background: #8BC34A; }
.stop-3 { top: 25%; left: 75%; background: #2196F3; }
.stop-4 { top: 65%; left: 80%; background: #2196F3; }
.stop-5 { top: 80%; left: 35%; background: #FF5722; }

.robot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 15;
}

.robot-1 {
  background: #e41a1c;
  animation: moveRobot1 8s ease-in-out infinite;
}

.robot-2 {
  background: #377eb8;
  animation: moveRobot2 8s ease-in-out infinite;
}

@keyframes moveRobot1 {
  0%, 100% { top: 50%; left: 50%; }
  25% { top: 30%; left: 20%; }
  50% { top: 70%; left: 15%; }
  75% { top: 80%; left: 35%; }
}

@keyframes moveRobot2 {
  0%, 100% { top: 50%; left: 50%; }
  25% { top: 25%; left: 75%; }
  50% { top: 65%; left: 80%; }
  75% { top: 50%; left: 65%; }
}

.route-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.route-path {
  stroke-dashoffset: 300;
  animation: drawPath 4s ease-in-out infinite alternate;
}

@keyframes drawPath {
  to {
    stroke-dashoffset: 0;
  }
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
}

.metric-label {
  display: block;
  font-size: 11px;
  color: #666;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Constraints Visual */
.constraints-visual {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.constraint-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 20px 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.constraint-item:hover {
  border-color: #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.constraint-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.constraint-item span {
  display: block;
  font-size: 12px;
  color: #555;
  font-weight: 500;
}

/* AI Visual */
.ai-visual {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.algo-badge {
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  transition: all 0.2s ease;
}

.algo-badge.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.algo-badge:hover {
  transform: translateY(-1px);
}

/* Tags */
.tags.small-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  margin-top: 4px;
}

.small-tags .tag {
  font-size: 11px;
  padding: 4px 10px;
}

.tag {
  font-size: 13px;
  color: #888;
  font-family: 'Manrope', Arial, Helvetica, sans-serif;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 3px 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  box-sizing: border-box;
  display: inline-block;
  transition: all 0.2s ease;
}

.tag:hover {
  border-color: #bbb;
  color: #555;
}

.desc {
  font-size: 15px;
  opacity: 0.9;
  margin-bottom: 0;
  margin-top: 10px;
  font-weight: 300;
  line-height: 1.6;
  color: #444;
  transition: all 0.3s ease;
}

.desc.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.justified {
  text-align: justify;
}

/* Expand Button */
.expand-btn {
  background: none;
  border: none;
  color: #666;
  font-family: 'Manrope', Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.expand-btn:hover {
  color: #111;
}

.expand-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.expand-btn.expanded svg {
  transform: rotate(180deg);
}

/* SDG Section */
.sdg-section {
  margin: 48px 0;
  text-align: center;
}

.sdg-label {
  font-size: 12px;
  color: #999;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 20px;
}

.sdg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.sdg-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.sdg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.sdg-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #111;
  margin-bottom: 6px;
}

.sdg-title {
  display: block;
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

/* ==================== INTERACTIVE DEMO ==================== */
.demo-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.demo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.demo-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: all 0.3s ease;
}

.status-dot.active {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: blink 1s ease-in-out infinite;
}

.status-dot.success {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#status-text {
  font-size: 0.85rem;
  color: #666;
}

.demo-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #eee;
}

.control-btn svg {
  stroke: #666;
}

.demo-canvas-wrapper {
  position: relative;
  background: #f8f9fa;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

#routeCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fafafa;
}

.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: #666;
}

/* Live Metrics */
.live-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.live-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  background: #fff;
  border-radius: 10px;
}

.live-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #000;
}

.live-metric-label {
  font-size: 0.7rem;
  color: #666;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Comparison Panel */
.comparison-panel {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 16px;
  margin-top: 0.5rem;
}

.comparison-header {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comparison-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comparison-label {
  font-size: 0.85rem;
  color: #666;
}

.comparison-bar {
  position: relative;
  height: 28px;
  background: #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
}

.comparison-bar .bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease-out;
}

.comparison-bar.baseline .bar-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.comparison-bar.optimized .bar-fill {
  background: linear-gradient(90deg, #10b981, #14b8a6);
}

.comparison-bar .bar-value {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: #333;
}

.improvement-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-radius: 8px;
  margin-top: 1rem;
}

.improvement-badge span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #059669;
}

/* Tech deep dive */
.tech-deep-dive {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 16px;
}

.tech-section {
  margin-bottom: 1.5rem;
}

.tech-section:last-child {
  margin-bottom: 0;
}

.tech-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.tech-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.tech-step {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  background: #000;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.step-content strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.step-content p {
  font-size: 0.75rem;
  color: #666;
  line-height: 1.4;
  margin: 0;
}

.constraint-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.constraint-detail {
  padding: 1rem;
  background: #fff;
  border-radius: 10px;
  text-align: center;
}

.constraint-detail code {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  background: #f0f0f0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.constraint-detail span {
  font-size: 0.75rem;
  color: #666;
}

/* Responsive adjustments for demo */
@media (max-width: 768px) {
  .live-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tech-steps,
  .constraint-details {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .live-metrics,
  .tech-steps,
  .constraint-details {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.footer {
  background: #fafafa;
  border-top: 1px solid #eee;
  padding: 48px;
  margin-top: 48px;
}

.footer-content {
  text-align: center;
}

.footer-logo {
  display: block;
  font-size: 20px;
  font-weight: 500;
  color: #111;
  margin-bottom: 8px;
}

.footer-tagline {
  display: block;
  font-size: 14px;
  color: #888;
  font-weight: 300;
  margin-bottom: 20px;
}

.footer-links {
  margin-bottom: 20px;
}

.footer-links a {
  color: #555;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #111;
}

.footer-divider {
  color: #ccc;
  margin: 0 12px;
}

.footer-copy {
  display: block;
  font-size: 12px;
  color: #bbb;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Mobile responsive */
@media screen and (max-width: 780px) {
  .frame {
    margin: 0;
    max-width: none;
    border: none;
  }

  .header-content {
    padding-left: 5vw;
    padding-right: 5vw;
    width: 100%;
  }

  .intro h1 {
    font-size: 28px;
    line-height: 1.2;
  }

  main {
    padding-left: 5vw;
    padding-right: 5vw;
    padding-top: 100px;
  }

  .supports-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .metrics-grid,
  .constraints-visual {
    grid-template-columns: repeat(2, 1fr);
  }

  .sdg-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .footer {
    padding: 32px 5vw;
  }
}

@media screen and (max-width: 480px) {
  .intro h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 15px;
  }

  .subtitle br {
    display: none;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .ai-visual {
    flex-direction: column;
  }

  .algo-badge {
    text-align: center;
  }
}
