:root {
  color-scheme: light;
  font-family: var(--font-family, Inter, system-ui, sans-serif);
  background: var(--background-color, #f5f7fb);
  color: var(--text-color, #1d2939);
  --page-max-width: 1080px;
  --surface-color: var(--surface-color, #ffffff);
  --primary-color: var(--primary-color, #1f4e79);
  --accent-color: var(--accent-color, #dd6b20);
  --muted-color: var(--muted-color, #4b5563);
  --border-color: var(--border-color, #d1d5db);
  --nav-text-color: var(--nav-text-color, #ffffff);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  line-height: 1.6;
}

body {
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.site-header {
  background: var(--primary-color);
  color: var(--nav-text-color);
  padding: 1.5rem 1rem;
}

.site-brand {
  max-width: var(--page-max-width);
  margin: 0 auto;
}

.site-brand h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
}

.site-brand p {
  margin: 0.5rem 0 0;
  opacity: 0.9;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: var(--page-max-width);
  margin: 1.5rem auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--nav-text-color);
  font-weight: 600;
}

.site-nav a.active,
.site-nav a:hover {
  background: rgba(255, 255, 255, 0.24);
}

main {
  flex: 1;
  width: min(100%, var(--page-max-width));
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 3vw, 2.75rem);
}

.section {
  margin-bottom: 2.5rem;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: clamp(1.75rem, 2.5vw, 2rem);
}

.section p,
.section li {
  color: var(--text-color);
}

.card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.075);
}

.card h3 {
  margin-top: 0;
}

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

.metadata-list,
.publication-list,
.teaching-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.metadata-list li,
.publication-list li,
.teaching-list li {
  margin-bottom: 0.75rem;
}

.publication-list li::marker,
.teaching-list li::marker,
.metadata-list li::marker {
  color: var(--accent-color);
}

footer {
  width: min(100%, var(--page-max-width));
  margin: 0 auto 2rem;
  padding: 0 1rem;
  color: var(--muted-color);
  font-size: 0.95rem;
}

.footer-note {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.highlight {
  color: var(--primary-color);
  font-weight: 700;
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

iframe {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface-color);
}

.emulator-panel {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.emulator-panel canvas {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 240 / 160;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: #000;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-row button,
.button-link {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-row button.secondary,
.button-link.secondary {
  background: var(--accent-color);
}

.button-row button:hover,
.button-row button:focus {
  opacity: 0.95;
}

.key-instructions {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

@media (max-width: 680px) {
  .site-nav {
    flex-direction: column;
  }

  .button-row {
    flex-direction: column;
  }
}
