/* --- Tokens --- */
:root {
  --bg-deep: #06080d;
  --bg: #0c0f16;
  --bg-elevated: #121826;
  --border: rgba(0, 212, 170, 0.15);
  --text: #e8ecf4;
  --text-muted: #8b95a8;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.35);
  --amber: #f4a742;
  --amber-dim: rgba(244, 167, 66, 0.25);
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 12px;
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
}

/* Texture & grid */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grid-bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 212, 170, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-h);
  background: rgba(6, 8, 13, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.logo span {
  color: var(--accent);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--accent);
}

/* Sections */
.section {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0;
  color: var(--text-muted);
  max-width: 52ch;
}

/* Hero */
.hero {
  padding-top: 3rem;
  padding-bottom: 5rem;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 70%;
  background: radial-gradient(ellipse, var(--accent-dim) 0%, transparent 65%);
  filter: blur(60px);
  pointer-events: none;
}

.hero__inner {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero__inner {
    grid-template-columns: minmax(280px, 340px) 1fr;
  }
}

/* Photo frame — “instrument panel” aesthetic */
.photo-frame {
  position: relative;
  padding: 12px;
  background: linear-gradient(145deg, var(--bg-elevated) 0%, #0a0d14 100%);
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(0, 212, 170, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.photo-frame::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 4px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    transparent 40%,
    transparent 60%,
    var(--amber) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.65;
}

.photo-frame__corners {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 2px;
}

.photo-frame__corners::before,
.photo-frame__corners::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
}

.photo-frame__corners::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.photo-frame__corners::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.photo-frame__scanline {
  position: absolute;
  inset: 12px;
  border-radius: 2px;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.photo-frame__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-elevated);
}

.photo-frame__label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  opacity: 0.85;
  text-transform: uppercase;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--amber);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.hero__title {
  margin: 0 0 1rem;
}

.hero__name {
  display: block;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero__tagline {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text-muted);
}

.hero__lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  max-width: 52ch;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
}

.hero__chips li {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(0, 212, 170, 0.06);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn--primary {
  background: linear-gradient(135deg, #00c49a 0%, #00a884 100%);
  color: #04120e;
  border: none;
  box-shadow: 0 4px 20px var(--accent-dim);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--accent-dim);
}

.btn--ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Timeline split */
.timeline-section .section-head {
  margin-bottom: 2.5rem;
}

.timeline-split {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 800px) {
  .timeline-split {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
  }
}

.rail__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.rail__header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.rail__icon {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(0, 212, 170, 0.12);
  color: var(--accent);
}

.rail__icon svg {
  width: 20px;
  height: 20px;
}

.rail--academic .rail__icon--photonic {
  background: rgba(244, 167, 66, 0.12);
  color: var(--amber);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  opacity: 0.4;
}

.rail--academic .timeline::before {
  background: linear-gradient(180deg, var(--amber) 0%, transparent 100%);
}

.timeline__item {
  position: relative;
  padding: 0 0 2rem 1.75rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__node {
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}

.rail--academic .timeline__node {
  border-color: var(--amber);
  box-shadow: 0 0 12px var(--amber-dim);
}

.timeline__year {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.rail--academic .timeline__year {
  color: var(--amber);
}

.timeline__item h4 {
  margin: 0.35rem 0 0.15rem;
  font-size: 1.05rem;
}

.timeline__place {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.timeline__item p:last-child {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Skills bullets */
.skills-block {
  padding-top: 2rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.skills-block__title {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
}

.skills-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 600px) {
  .skills-list {
    grid-template-columns: 1fr 1fr;
  }
}

.skills-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.bullet-circuit {
  flex-shrink: 0;
  width: 22px;
  height: 14px;
  margin-top: 0.25rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  position: relative;
  background: linear-gradient(90deg, transparent 45%, var(--accent) 45%, var(--accent) 55%, transparent 55%);
}

.bullet-circuit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateX(-50%);
}

.bullet-waveguide {
  flex-shrink: 0;
  width: 22px;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  box-shadow: 0 0 12px var(--amber-dim);
}

/* Tapeout */
.tapeout-card {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

@media (min-width: 700px) {
  .tapeout-card {
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
  }
}

.tapeout-card__visual {
  min-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background: #050608;
}

.fake-gds {
  position: relative;
  height: 100%;
  min-height: 200px;
  background-image:
    linear-gradient(rgba(0, 212, 170, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.08) 1px, transparent 1px);
  background-size: 16px 16px;
}

.fake-gds span:not(.fake-gds__die) {
  position: absolute;
  background: rgba(0, 212, 170, 0.25);
  border: 1px solid rgba(0, 212, 170, 0.4);
}

.fake-gds span:nth-child(1) {
  top: 12%;
  left: 8%;
  width: 35%;
  height: 18%;
}

.fake-gds span:nth-child(2) {
  top: 38%;
  right: 10%;
  width: 28%;
  height: 22%;
  background: rgba(244, 167, 66, 0.2);
  border-color: rgba(244, 167, 66, 0.45);
}

.fake-gds span:nth-child(3) {
  bottom: 18%;
  left: 12%;
  width: 40%;
  height: 14%;
}

.fake-gds span:nth-child(4) {
  top: 22%;
  right: 18%;
  width: 12%;
  height: 8%;
}

.fake-gds__die {
  position: absolute;
  inset: 22%;
  border: 2px dashed rgba(0, 212, 170, 0.35);
  border-radius: 4px;
  background: rgba(0, 212, 170, 0.05);
}

.tapeout-card__body h3 {
  margin: 0 0 0.75rem;
}

.tapeout-card__body p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.tapeout-meta {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tapeout-meta li {
  margin-bottom: 0.35rem;
}

.tapeout-meta strong {
  color: var(--text);
  font-weight: 500;
}

/* Research */
.research-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .research-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.research-card {
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.research-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.research-card__tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.research-card h3 {
  margin: 0.5rem 0 0.75rem;
  font-size: 1.05rem;
}

.research-card p {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.research-card__link {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.research-card__link:hover {
  text-decoration: underline;
}

/* Personal */
.personal-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 600px) {
  .personal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.personal-card {
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--bg-elevated), #0e1118);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.personal-card__icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.personal-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.personal-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
