* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #fafafa;
  --color-bg-alt: #f0f0f0;
  --color-text: #1a1a1a;
  --color-text-muted: #666;
  --color-accent: #2c5f8a;
  --color-accent-light: #e8f0f8;
  --color-border: #e0e0e0;
  --color-green: #2d8a4e;
  --color-red: #c0392b;
  --color-amber: #d4a017;
  --font-sans: 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --max-width: 960px;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex;
  justify-content: center;
  gap: 32px;
  z-index: 100;
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--color-accent);
}

/* Hero */
.hero {
  text-align: center;
  padding: 140px 24px 80px;
  background: white;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.tagline {
  font-size: 20px;
  color: var(--color-accent);
  font-weight: 500;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 18px;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 24px;
}

.links {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.links a {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 16px;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  transition: all 0.2s;
}

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

/* Sections */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section h2 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-intro {
  font-size: 18px;
  color: var(--color-text-muted);
  margin-bottom: 40px;
  max-width: 640px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--color-text-muted);
  font-size: 14px;
  border-top: 1px solid var(--color-border);
}

/* Scroll to top button */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  border: none;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.15s ease, background 0.15s ease;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-2px);
  background: #1f4866;
}

.scroll-top:active {
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 32px;
  }
  .tagline {
    font-size: 16px;
  }
  .subtitle {
    font-size: 16px;
  }
  .section h2 {
    font-size: 24px;
  }
  .links {
    flex-direction: column;
    align-items: center;
  }
  .nav {
    gap: 16px;
  }
}

/* Course as Product Section */
.methodology {
  margin-bottom: 48px;
}

.methodology h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.method-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px;
  transition: box-shadow 0.2s;
}

.method-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.method-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.method-card h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.method-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.stats-bar {
  display: flex;
  justify-content: space-around;
  background: var(--color-accent);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 48px;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: white;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
}

.gallery-intro {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 640px;
}

h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.project-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.project-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.project-screenshot {
  height: 180px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
}

.project-screenshot-link {
  display: block;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  background: var(--color-bg-alt);
}

.project-screenshot-img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-screenshot-link:hover .project-screenshot-img {
  transform: scale(1.02);
}

.placeholder-text {
  font-size: 14px;
  color: var(--color-text-muted);
  font-style: italic;
}

.project-info {
  padding: 20px;
}

.project-info h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.project-info p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: 12px;
}

.project-links {
  display: flex;
  gap: 16px;
}

.project-link {
  font-size: 14px;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

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

.callout {
  background: var(--color-accent-light);
  border-left: 4px solid var(--color-accent);
  padding: 24px 28px;
  border-radius: 0 8px 8px 0;
}

.callout p {
  font-family: var(--font-serif);
  font-size: 17px;
  font-style: italic;
  color: var(--color-text);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .method-grid {
    grid-template-columns: 1fr;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .stats-bar {
    flex-wrap: wrap;
    gap: 16px;
  }
  .stat {
    width: 45%;
  }
}

/* Research / Visualization Section */
.research-context {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
  max-width: 640px;
}

.viz-container {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
  margin-bottom: 32px;
}

.viz-header h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.viz-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.chart-area {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 280px;
  padding: 0 8px 40px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  flex: 1;
}

.bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 220px;
}

.bar {
  width: 28px;
  border-radius: 3px 3px 0 0;
  transition: height 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.2s;
  position: relative;
}

.bar-without {
  background: #b0bec5;
}

.bar-with {
  background: var(--color-accent);
}

.bar-with.declined {
  background: var(--color-red);
}

.bar-group:hover .bar {
  opacity: 0.8;
}

.bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.2;
}

.bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.bar-group:hover .bar-value {
  opacity: 1;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.legend-without {
  background: #b0bec5;
}

.legend-with {
  background: var(--color-accent);
}

/* Drilldown Panel */
.drilldown {
  display: none;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
  margin-bottom: 32px;
  position: relative;
  animation: slideDown 0.3s ease-out;
}

.drilldown.active {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.drilldown-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.drilldown-close:hover {
  color: var(--color-text);
}

.drilldown h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.drilldown p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.site-comparison {
  display: flex;
  gap: 24px;
  margin: 16px 0;
}

.site-box {
  flex: 1;
  background: var(--color-bg);
  border-radius: 6px;
  padding: 16px;
}

.site-box h5 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.site-score {
  font-size: 13px;
  margin-bottom: 4px;
}

.score-change-positive {
  color: var(--color-green);
  font-weight: 600;
}

.score-change-negative {
  color: var(--color-red);
  font-weight: 600;
}

.failure-modes {
  margin-top: 16px;
}

.failure-mode {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.failure-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-red);
  background: #fde8e8;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.failure-desc {
  font-size: 14px;
  color: var(--color-text);
}

/* Insight Cards */
.insight-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.insight-card {
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.insight-positive {
  background: #f0f9f4;
  border-color: #c3e6cb;
}

.insight-negative {
  background: #fdf2f2;
  border-color: #f5c6cb;
}

.insight-icon {
  font-size: 14px;
  margin-bottom: 8px;
}

.insight-positive .insight-icon {
  color: var(--color-green);
}

.insight-negative .insight-icon {
  color: var(--color-red);
}

.insight-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
}

@media (max-width: 640px) {
  .chart-area {
    height: 200px;
    padding-bottom: 50px;
  }
  .bar {
    width: 18px;
  }
  .bar-label {
    font-size: 9px;
  }
  .insight-cards {
    grid-template-columns: 1fr;
  }
  .site-comparison {
    flex-direction: column;
  }
  .viz-container {
    padding: 20px;
  }
}
