:root {
  --bg: #0a0f1a;
  --surface: #111827;
  --border: #1f2937;
  --text: #9ca3af;
  --heading: #f3f4f6;
  --accent: #64ffda;
  --accent-dim: rgba(100, 255, 218, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "SF Mono", "Fira Code", monospace;
  --nav-h: 64px;
  --max: 760px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.75; }
ul { list-style: none; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 2rem;
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-size: 0.875rem;
  color: var(--heading);
}

.nav-links a, .nav-back { color: var(--heading); }
.nav-links a:hover, .nav-back:hover { color: var(--accent); opacity: 1; }

.nav-back {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--heading);
}

.nav-resume {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent) !important;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.nav-resume:hover { background: var(--accent-dim); opacity: 1; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.section-heading {
  font-size: 0.75rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 2rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }

.btn--outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn--outline:hover { background: var(--accent-dim); opacity: 1; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

.hero-greeting {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  animation: up 0.5s ease 0.1s both;
}

.hero-name {
  font-size: clamp(2.25rem, 7vw, 4rem);
  font-weight: 700;
  color: var(--heading);
  line-height: 1.1;
  margin-bottom: 1rem;
  animation: up 0.5s ease 0.2s both;
}

.hero-focus {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
  animation: up 0.5s ease 0.3s both;
}

.hero-bio {
  max-width: 560px;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 2.5rem;
  animation: up 0.5s ease 0.4s both;
}

.hero-links {
  display: flex;
  gap: 1rem;
  animation: up 0.5s ease 0.5s both;
}

@keyframes up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Project Cards ───────────────────────────────────────────────────────── */
.card-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  opacity: 1;
}

.card-preview {
  width: 110px;
  height: 80px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  background: var(--bg);
}

.card-preview[src$=".png"] {
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.card-preview--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--border);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.25rem;
}

.card-tagline {
  font-size: 0.8125rem;
  color: var(--text);
  margin-bottom: 0.625rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.card-tags li {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
}

.card-arrow {
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.card:hover .card-arrow { transform: translateX(4px); }

/* ── Project Detail ──────────────────────────────────────────────────────── */
.project-detail {
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 3rem) 2rem 4rem;
}

.project-detail-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.project-detail-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--heading);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.project-detail-tagline {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.project-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-detail-tags li {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.625rem;
  border-radius: 3px;
}

.detail-section {
  margin-bottom: 3rem;
}

.detail-heading {
  font-size: 0.75rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.detail-video {
  width: 100%;
  border-radius: 6px;
  background: #000;
  display: block;
}

.detail-image {
  width: 100%;
  border-radius: 6px;
  display: block;
}

.detail-image--render {
  background: #fff;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 600px;
  margin: 0 auto;
}

.detail-prose {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.detail-contribution {
  border-left: 2px solid var(--accent);
  padding: 0.75rem 1rem;
  background: rgba(100, 255, 218, 0.05);
  border-radius: 0 4px 4px 0;
  margin: 1.25rem 0;
}

.detail-contribution-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}

.detail-contribution p {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.7;
  margin: 0;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.asset-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  transition: color 0.2s;
}
.asset-link:hover { color: var(--accent); opacity: 1; }

/* ── Simulation / Math ───────────────────────────────────────────────────── */
.sim-eq-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.sim-eq-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}

.sim-eq-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.sim-eq {
  overflow-x: auto;
  padding: 0.5rem 0;
  color: var(--heading);
  text-align: center;
}

.sim-eq-note {
  font-size: 0.8125rem;
  color: var(--text);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.sim-figure {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0.5rem;
}

.detail-video-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .sim-eq-row { grid-template-columns: 1fr; }
  .detail-video-pair { grid-template-columns: 1fr; }
}

/* ── 3D Viewer ───────────────────────────────────────────────────────────── */
.viewer {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #0d1117;
  border: 1px solid var(--border);
}

#swerve-canvas {
  display: block;
  width: 100%;
  height: 480px;
  cursor: grab;
}
#swerve-canvas:active { cursor: grabbing; }

.viewer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.95);
}

.viewer-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.viewer-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.viewer-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.viewer-hint {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text);
  opacity: 0.5;
  white-space: nowrap;
}

.viewer-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  opacity: 0.8;
  z-index: 10;
}

/* ── Publications ────────────────────────────────────────────────────────── */
.publication {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pub-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.375rem;
  line-height: 1.5;
}

.pub-meta {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pub-doi {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

/* ── FRC Section ─────────────────────────────────────────────────────────── */
.frc-story {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}

.frc-story p {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.8;
}

.frc-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.frc-entry {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.frc-entry-meta {
  margin-bottom: 0.625rem;
}

.frc-year-label {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}

.frc-description {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.6;
}

.frc-year {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.frc-robot-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
}

.frc-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  border-radius: 8px;
  overflow: hidden;
}

.frc-robot-link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--border);
  aspect-ratio: 4/3;
  background: var(--surface);
}

.frc-robot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.frc-robot-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(10, 15, 26, 0.6);
  opacity: 0;
  transition: opacity 0.2s;
}

.frc-robot-link:hover .frc-robot-img { transform: scale(1.03); filter: brightness(0.6); }
.frc-robot-link:hover .frc-robot-overlay { opacity: 1; }

.frc-video {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}

/* ── Resume Page ─────────────────────────────────────────────────────────── */
.resume-page {
  padding: calc(var(--nav-h) + 3rem) 2rem 4rem;
}

.resume-doc {
  max-width: 760px;
  margin: 0 auto;
}

.resume-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.resume-name {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
  margin-bottom: 0.375rem;
}

.resume-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.resume-contact {
  font-size: 0.875rem;
  color: var(--text);
}
.resume-contact a { color: var(--text); }
.resume-contact a:hover { color: var(--accent); opacity: 1; }

.resume-section {
  margin-bottom: 2.5rem;
}

.resume-section-heading {
  font-size: 0.6875rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.resume-prose {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.75;
}

.resume-competencies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.resume-competency {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.6;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.resume-competency-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.resume-entry {
  margin-bottom: 1.75rem;
}

.resume-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 0.25rem;
}

.resume-org {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--heading);
}

.resume-location {
  font-size: 0.875rem;
  color: var(--text);
}

.resume-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
}

.resume-tech {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.resume-role {
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.resume-bullets {
  list-style: none;
  padding: 0;
}

.resume-bullets li {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.7;
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.375rem;
}

.resume-bullets li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.resume-download {
  display: flex;
  justify-content: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text); }
.footer a:hover { color: var(--accent); opacity: 1; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  main, .project-detail { padding-left: 1.25rem; padding-right: 1.25rem; }
  .nav { padding: 0 1.25rem; }
  .nav-links { gap: 1rem; }
  .hero-links { flex-direction: column; align-items: flex-start; }
  .card-preview { width: 80px; height: 60px; }
  .card-tags { display: none; }
  .resume-competencies { grid-template-columns: 1fr; }
  .resume-entry-header { flex-direction: column; gap: 0.125rem; }
  .frc-media { grid-template-columns: 1fr; }
}
