:root {
  --bg: #f0ead6;
  --card: #f8f4e8;
  --surface: #ebe4ce;
  --text: #474d49;
  --muted: #646a66;
  --border: rgba(60, 45, 20, 0.12);
  --border-strong: rgba(60, 45, 20, 0.3);
  --accent: #3f68b5;
  --accent-soft: #e8eef9;
  --placeholder: #e8e1cb;
  --stripe: rgba(0, 0, 0, 0.035);
  --shadow: rgba(60, 45, 20, 0.16);
  --gt-hover-text: #474d49;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46'%3E%3Ctext x='23' y='30' font-family='Georgia,serif' font-size='15' fill='%23222' fill-opacity='0.15' text-anchor='middle'%3E*%3C/text%3E%3C/svg%3E");

  --serif: "Faustina", Georgia, serif;
  --sans: "Google Sans", system-ui, -apple-system, sans-serif;

  --width: 760px;
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #131111;
  --card: #1a1717;
  --surface: #231f1f;
  --text: #f3f0ea;
  --muted: #bcb6ac;
  --border: rgba(255, 245, 230, 0.1);
  --border-strong: rgba(255, 245, 230, 0.3);
  --accent: #8fb0ec;
  --accent-soft: rgba(143, 176, 236, 0.12);
  --placeholder: #1c1a1a;
  --stripe: rgba(255, 255, 255, 0.04);
  --shadow: rgba(0, 0, 0, 0.6);
  --gt-hover-text: #131111;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46'%3E%3Ctext x='23' y='30' font-family='Georgia,serif' font-size='15' fill='%23fff' fill-opacity='0.14' text-anchor='middle'%3E*%3C/text%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--pattern);
  background-size: 46px 46px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Theme switches must be instant per-element; the smooth fade comes from
   the view transition crossfading the whole page at once. */
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: ease;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.icon-fill {
  fill: currentColor;
  stroke: none;
}

/* ── Top bar ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: var(--width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-nav a:hover {
  color: var(--text);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  transform: rotate(15deg);
}

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon {
  display: none;
}

/* ── Layout ──────────────────────────────────── */
.page {
  max-width: var(--width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 0;
}

.page > section + section {
  margin-top: 4rem;
}

.page > section {
  scroll-margin-top: 1.5rem;
}

.section-head {
  margin-bottom: 1.5rem;
}

.section-head h2 {
  font-size: 1.75rem;
}

.section-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.section-head a,
.intro p a {
  color: var(--accent);
  text-decoration: none;
}

.section-head a:hover {
  text-decoration: underline;
}

.section-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Intro ───────────────────────────────────── */
.intro .hello {
  margin: 0;
  font-size: 1.1rem;
}

.wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 1.8s ease-in-out 0.5s 1;
}

.intro .hello:hover .wave {
  animation: wave 1.8s ease-in-out infinite;
}

@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

.intro h1 {
  font-size: clamp(3rem, 9vw, 5.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.015em;
  opacity: 0.8;
  margin: 0.1em 0 1.1rem;
}

.intro p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 62ch;
}

/* Georgia Tech Buzz Gold. Yellow text is unreadable on white, so light mode
   uses it as a highlighter stripe instead. */
.intro p a.gt {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(transparent 58%, #eaaa00 58%, #eaaa00 92%, transparent 92%);
  padding: 0 0.1em;
}

.intro p a.gt:hover {
  background: #eaaa00;
}

[data-theme="dark"] .intro p a.gt {
  color: #eaaa00;
  background: none;
}

[data-theme="dark"] .intro p a.gt:hover {
  color: var(--gt-hover-text);
  background: #eaaa00;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.pill:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.pill-icon {
  padding: 0.45rem;
  font-size: 0.95rem;
}

.pill-accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-accent:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ── Now ─────────────────────────────────────── */
.now {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.now-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.now-head h2 {
  font-size: 1.25rem;
}

.now-date {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.now ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.now li + li {
  margin-top: 0.25rem;
}

.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* ── Experience ──────────────────────────────── */
.logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  padding: 0 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.2s ease;
}

.logo:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.logo img {
  height: 1.6rem;
  width: auto;
  filter: grayscale(1);
  opacity: 0.8;
  transition: filter 0.2s, opacity 0.2s;
}

.logo:hover img {
  filter: none;
  opacity: 1;
}

[data-theme="dark"] .logo img {
  filter: grayscale(1) invert(1);
}

[data-theme="dark"] .logo:hover img {
  filter: invert(1);
}

.logo-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── Projects ────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--border-strong);
  box-shadow: 0 12px 30px -12px var(--shadow);
}

.card-img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.card-img.is-diagram {
  object-fit: contain;
  background: var(--placeholder);
}

.card-img.is-empty {
  background: repeating-linear-gradient(45deg, var(--stripe) 0 10px, transparent 10px 20px), var(--placeholder);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.15rem 1.35rem 1.35rem;
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.card p {
  flex: 1;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.card p:has(+ .stats) {
  flex: none;
}

.stats {
  flex: 1;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.stats li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.stats b {
  color: var(--text);
  font-weight: 600;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.8;
}

.tag .live-dot {
  width: 6px;
  height: 6px;
}

.tag-blue { background: #e0ecff; color: #1d4ed8; }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-violet { background: #ede9fe; color: #6d28d9; }
.tag-amber { background: #fef3c7; color: #b45309; }
.tag-rose { background: #ffe4e6; color: #be123c; }
.tag-slate { background: #e2e8f0; color: #334155; }

[data-theme="dark"] .tag-blue { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
[data-theme="dark"] .tag-green { background: rgba(34, 197, 94, 0.14); color: #86efac; }
[data-theme="dark"] .tag-violet { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
[data-theme="dark"] .tag-amber { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
[data-theme="dark"] .tag-rose { background: rgba(244, 63, 94, 0.14); color: #fda4af; }
[data-theme="dark"] .tag-slate { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}

.link {
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.8;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.link:hover {
  border-color: var(--border-strong);
}

.link-primary {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}

.link-primary:hover {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

/* ── Writing ─────────────────────────────────── */
.posts {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.posts li {
  border-bottom: 1px solid var(--border);
}

.post {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 0.25rem;
  text-decoration: none;
  transition: padding-left 0.2s ease;
}

.post:hover {
  padding-left: 0.6rem;
}

.post h3 {
  font-size: 1.15rem;
  transition: color 0.15s;
}

.post:hover h3 {
  color: var(--accent);
}

.post p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.post time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ── Footer ──────────────────────────────────── */
.footer {
  max-width: var(--width);
  margin: 5rem auto 0;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
}

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

.footer a:hover {
  text-decoration: underline;
}

.footer-small {
  margin-top: 0.35rem !important;
  font-size: 0.8rem;
}

.card-title {
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── Project write-up pages ──────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 1.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.article-header h1 {
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0.35rem 0 1rem;
}

.lede {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

.article section {
  margin-top: 2.75rem;
}

.article h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.article section > p,
.article section > ul {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.article section > p {
  margin: 0 0 1rem;
}

.article section > ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.article section > ul li + li {
  margin-top: 0.35rem;
}

.figure {
  margin: 1.5rem 0;
}

.media {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--placeholder);
}

.media.is-diagram {
  object-fit: contain;
  background: var(--card);
}

.media.is-empty {
  background: repeating-linear-gradient(45deg, var(--stripe) 0 10px, transparent 10px 20px), var(--placeholder);
}

.figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.figure-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.figure-row .figure {
  margin: 0;
}

.figure-row .media {
  aspect-ratio: 4 / 3;
}

.article .results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 2rem;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.result-value {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.result-label {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skills li {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.spec-table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.spec-table th,
.spec-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.spec-table tr:first-child th,
.spec-table tr:first-child td {
  border-top: 1px solid var(--border);
}

.spec-table th {
  width: 7rem;
  color: var(--muted);
  font-weight: 600;
}

.spec-table td {
  color: var(--text);
}

.next-project {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 3.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.next-project span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.next-project a {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s;
}

.next-project a:hover {
  color: var(--accent);
}

/* ── Small screens ───────────────────────────── */
@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .post {
    flex-direction: column;
    gap: 0.25rem;
  }

  .post time {
    order: -1;
    font-size: 0.8rem;
  }

  .article .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .figure-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
