/* ========== Base ========== */
:root {
  --bg-dark: #0b1020;
  --bg-darker: #05070f;
  --accent: #6ee7f9;
  --accent2: #a78bfa;
  --accent3: #f472b6;
  --text-light: #eaf0ff;
  --text-dim: #9aa5c0;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --max-width: 1100px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-light);
  background: var(--bg-dark);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ========== Animated Background ========== */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    -45deg,
    var(--bg-darker),
    #101733,
    #1a1140,
    var(--bg-darker)
  );
  background-size: 400% 400%;
  animation: gradientShift 18s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.6); }
}

/* Orbiting particle (rocket theme nod) */
.orbit-wrap {
  position: fixed;
  top: 12%;
  right: 8%;
  width: 220px;
  height: 220px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(110, 231, 249, 0.3);
  border-radius: 50%;
  animation: spin 20s linear infinite;
}

.orbit-dot {
  position: absolute;
  top: -6px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== Navbar ========== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  background: rgba(5, 7, 15, 0.65);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}

.nav-logo {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: hueSlide 6s linear infinite;
}

@keyframes hueSlide {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-light);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

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

section {
  margin-bottom: 4rem;
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Hero ========== */
.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.hero-eyebrow {
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.1s;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.1;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.25s;
}

.hero h1 .highlight {
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: hueSlide 6s linear infinite;
}

.hero .subtitle {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 640px;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.4s;
}

.hero p.bio {
  color: var(--text-dim);
  max-width: 640px;
  line-height: 1.6;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.55s;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.7s;
}

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

/* ========== Buttons ========== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #0b1020;
}

.btn-secondary {
  border: 1px solid var(--card-border);
  color: var(--text-light);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(110, 231, 249, 0.15);
}

/* ========== Section Headings ========== */
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--text-dim);
  margin-bottom: 2rem;
  max-width: 700px;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s ease, border-color 0.35s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(110,231,249,0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(110, 231, 249, 0.4);
}

.card:hover::before {
  opacity: 1;
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Progress bar for research interest emphasis */
.bar-track {
  margin-top: 1rem;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.bar-fill,
.chart-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 1.4s ease;
}

.chart-row .bar-track {
  margin-top: 0;
  height: 10px;
}

.chart-row.baseline .chart-fill {
  background: linear-gradient(90deg, #55607f, #7b88ad);
}

.chart-row.agentic .chart-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent3));
}

/* ========== Project Page ========== */
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 760px) {
  .project-card {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }
}

.project-visual {
  height: 220px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(110,231,249,0.15), rgba(167,139,250,0.15));
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-visual .rocket {
  font-size: 3.5rem;
  animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(3deg); }
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--accent);
  background: rgba(110, 231, 249, 0.08);
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.15);
  color: var(--accent3);
  border: 1px solid rgba(244, 114, 182, 0.3);
  margin-bottom: 0.75rem;
}

/* ========== Project Page: Narrative Sections ========== */
.eyebrow-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}

/* Stat strip */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.stat-item {
  text-align: center;
  padding: 1.25rem 0.75rem;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.stat-number {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Pull-quote / research question box */
.quote-box {
  position: relative;
  padding: 1.75rem 2rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(110,231,249,0.08), rgba(167,139,250,0.08));
  border: 1px solid var(--card-border);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-light);
}

.quote-box::before {
  content: "“";
  position: absolute;
  top: -0.4rem;
  left: 1.2rem;
  font-size: 3.5rem;
  color: var(--accent);
  opacity: 0.4;
  font-family: Georgia, serif;
}

.quote-source {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Flow diagram */
.flow-diagram {
  position: relative;
  padding: 2.5rem 1rem 4.5rem;
}

.flow-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flow-node {
  flex: 1 1 150px;
  min-width: 130px;
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.flow-node .flow-icon {
  font-size: 1.4rem;
}

.flow-node:hover {
  transform: translateY(-4px);
  border-color: rgba(110, 231, 249, 0.5);
}

.flow-node.highlight {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 0 22px rgba(167, 139, 250, 0.15);
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.3rem;
  flex: 0 0 auto;
  padding: 0 0.15rem;
}

.flow-loop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.5rem;
  width: 100%;
  height: 70px;
  pointer-events: none;
}

.flow-loop-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  background: var(--bg-dark);
  padding: 0 0.5rem;
}

@media (max-width: 700px) {
  .flow-row {
    flex-direction: column;
  }
  .flow-arrow {
    transform: rotate(90deg);
  }
  .flow-loop {
    display: none;
  }
}

/* Config cards (what the agent configures) */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.config-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.5rem;
}

.config-card .config-num {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 1px;
  font-weight: 700;
}

.config-card h3 {
  margin: 0.4rem 0 0.5rem;
  font-size: 1.05rem;
}

.config-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Failure scenario matrix */
.matrix-wrap {
  overflow-x: auto;
}

.matrix-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.matrix-grid th,
.matrix-grid td {
  padding: 0.7rem 0.85rem;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--card-border);
}

.matrix-grid th {
  color: var(--text-light);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
}

.matrix-grid td.label {
  text-align: left;
  color: var(--text-light);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.02);
}

.matrix-grid td.cov {
  color: var(--accent);
  font-weight: 700;
}

.sev-mild { background: rgba(110, 231, 249, 0.08); }
.sev-mod { background: rgba(167, 139, 250, 0.12); }
.sev-sev { background: rgba(244, 114, 182, 0.14); }

/* Approach comparison chart */
.chart-block {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 160px 1fr 90px;
  align-items: center;
  gap: 0.85rem;
}

.chart-label {
  font-size: 0.85rem;
  color: var(--text-light);
}

.chart-value {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: right;
}

.chart-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: -0.5rem;
}

/* Metrics pill list */
.metric-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.metric-list .pill {
  color: var(--accent2);
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.08);
}

/* Two-column layout helper */
.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 860px) {
  .split-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========== Figures / Images ========== */
.figure-block {
  margin: 2rem 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}

.figure-block img {
  display: block;
  width: 100%;
  height: auto;
}

.figure-block.hero-figure img {
  max-height: 420px;
  object-fit: cover;
}

.figure-caption {
  padding: 0.85rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-top: 1px solid var(--card-border);
  line-height: 1.5;
}

.figure-caption a {
  color: var(--accent);
  text-decoration: none;
}

.figure-caption a:hover {
  text-decoration: underline;
}

.figure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 860px) {
  .figure-grid {
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
  }
}

.figure-block.literature img {
  background: #fff;
  padding: 0.75rem;
}

/* ========== Timeline (Research page / Dev Log) ========== */
.timeline {
  border-left: 2px solid var(--card-border);
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.65rem;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Dev Log specifics */
.log-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.log-date {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.log-tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--accent);
  background: rgba(110, 231, 249, 0.08);
}

.log-tag.shipped {
  color: var(--accent2);
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.08);
}

.log-tag.content {
  color: var(--accent3);
  border-color: rgba(244, 114, 182, 0.3);
  background: rgba(244, 114, 182, 0.08);
}

.timeline-item h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--text-light);
}

.timeline-item p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}

.timeline-item ul {
  margin: 0.5rem 0 0 1.1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ========== Footer ========== */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--card-border);
}

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

/* ========== Responsive Nav ========== */
@media (max-width: 620px) {
  .navbar {
    flex-direction: column;
    gap: 0.75rem;
  }
  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }
}
