

:root {

  --sidebar-bg: #cde8ff;
  --main-bg:    #f3f4f6;
  --card-bg:    #ffffff;
  --text:       #2b2b2b;
  --muted:      #6b6b6b;
  --accent:     #3a6ea5;
  --border:     rgba(0, 0, 0, 0.18);

  --sidebar-width: 28%;
  --content-max:   900px;

  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --speed:     0.35s;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18.5px;
  color: var(--text);
  background: var(--main-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
a:hover { color: var(--text); text-decoration: none; opacity: 0.85; }

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  background: var(--sidebar-bg);
  padding: 2.25rem 1.5rem;
  margin: 1.5rem;
  border-radius: 28px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.10);
  position: sticky;
  top: 1.5rem;
  align-self: flex-start;
  height: calc(100vh - 3rem);
  overflow-y: auto;
  text-align: center;
}

.sidebar .photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
  background: #ffffff;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}

.sidebar .name {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0.25rem 0;
  white-space: nowrap;
}

.sidebar .tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  white-space: nowrap;
}

.sidebar .links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar .links li { margin: 0.4rem 0; }

.sidebar .links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: transform var(--speed) var(--ease-soft), color var(--speed) var(--ease);
}
.sidebar .links a:hover { transform: translateY(-2px); opacity: 1; }

.sidebar .links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 0 3rem 2rem;
}

.topnav {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-bottom: 1px solid var(--border);
  margin: 0 -3rem 2rem;
  padding: 1.5rem 3rem 0;
  flex-wrap: wrap;

  position: sticky;
  top: 0;
  background: var(--main-bg);
  z-index: 40;
  transform: translateY(calc(var(--nav-offset, 0px) * -1));
}

.topnav a {
  position: relative;
  padding: 0.6rem 1.1rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
  border-radius: 999px;
  transition: background var(--speed) var(--ease),
              color var(--speed) var(--ease),
              transform var(--speed) var(--ease-soft);
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 0.3rem;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.125s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.topnav a:hover::after {
  transform: scaleX(1);
}

.topnav a:hover,
.topnav a.active:hover {
  color: var(--accent);
  opacity: 1;
}

.topnav a.active {
  color: var(--text);
  background: none;
}

.content { max-width: var(--content-max); }

.content h1 { font-size: 2rem; margin-top: 0; }
.content h2 { margin-top: 2rem; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.semester { margin-bottom: 1.5rem; }
.semester h3 { margin-bottom: 0.4rem; }
.semester ul { margin-top: 0.3rem; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: block;
  color: var(--text);
  transition: transform var(--speed) var(--ease-soft);
}

.project-card:hover {
  transform: translateY(-6px);
  text-decoration: none;
  opacity: 1;
}

.project-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  background: #e4e6ea center / cover no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  transition: box-shadow var(--speed) var(--ease-soft);
}

.project-card:hover .thumb {
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.20);
}

.project-card .title { font-weight: 700; font-size: 1.05rem; margin-top: 0.7rem; }
.project-card .year { color: var(--muted); font-size: 0.85rem; }

.back-link { display: inline-block; margin-bottom: 1rem; font-weight: 600; }

.project-highlights {
  background: #eef5fc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 1.4rem;
  margin: 0.5rem 0 2rem;
}
.project-highlights ul { margin: 0; padding-left: 1.2rem; }
.project-highlights li { margin: 0.15rem 0; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.tag-row li {
  background: var(--sidebar-bg);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-size: 0.9rem;
}

.report-img {
  display: block;
  max-width: 560px;
  width: 100%;
  height: auto;
  margin: 0.75rem auto 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 0.75rem 0;
}
.img-row .report-img { flex: 1 1 44%; min-width: 220px; max-width: none; margin: 0; }

.fig-caption { color: var(--muted); font-size: 0.9rem; margin: 0.75rem 0 0.25rem; }
.report-eyebrow {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.report-byline { color: var(--muted); font-style: italic; margin-top: 0; }

.toc-table { border-collapse: collapse; width: 100%; max-width: 520px; margin: 0.5rem 0 1rem; }
.toc-table td { border: 1px solid var(--border); padding: 0.4rem 0.75rem; font-size: 0.95rem; }

.report h2 { margin-top: 2.5rem; }
.report h3 { margin-top: 2rem; }
.report h4 { margin-top: 1.5rem; }

.report h2, .report h3, .report h4, .report .sec-anchor { scroll-margin-top: 90px; }
.report img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25rem auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.report table {
  border-collapse: collapse;
  width: 100%;
  max-width: 640px;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.report th, .report td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  text-align: left;
}
.report thead th { background: var(--sidebar-bg); }
.report .math { overflow-x: auto; }

.report { overflow-wrap: break-word; }
.report a { overflow-wrap: anywhere; }
.report table { display: block; max-width: 100%; overflow-x: auto; }

.report .cap-img {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.25rem auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}
.report .cap-img img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
  border: none;
  border-radius: 0;
}
.report .cap-img .cap-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.2rem 0.9rem 0.7rem;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.4;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.report .cap-img:hover .cap-text { opacity: 1; }

.report p.fig-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  margin: 1.25rem 0;
}
.report p.fig-row .cap-img,
.report p.fig-row > img {
  margin: 0;
  max-width: min(100%, 340px);
}

.report .gallery-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.report .ba-arrow { align-self: center; font-size: 2rem; color: var(--muted); padding: 0 0.25rem; }

.collab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.2rem;
  margin: 0.4rem 0 1rem;
}
.collab-btn {
  display: inline;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  transition: color var(--speed) var(--ease-soft);
}
.collab-btn:hover { color: var(--text); text-decoration: underline; opacity: 0.85; }

.back-to-top-wrap { text-align: center; margin: 2.5rem 0 1rem; }
.back-to-top {
  display: inline-block;
  color: var(--muted);
  font-weight: 500;
  transition: color var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
.back-to-top:hover { color: var(--text); text-decoration: none; opacity: 1; }

.resume-img {
  display: block;
  width: 100%;
  max-width: 800px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.main .content { animation: fadeUp 0.6s 0.08s var(--ease-soft) both; }

@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  animation: pageIn 0.18s var(--ease);
  transition: opacity 0.12s var(--ease);
}

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

@media (max-width: 800px) {
  .layout { flex-direction: column; }

  .sidebar {
    position: static;
    flex: 0 0 auto;
    align-self: stretch;
    height: auto;
    margin: 0 1rem 1.25rem;
    padding: 12px 16px;
    border-radius: 22px;
    overflow: visible;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }

  body:not([data-page="index"]) .sidebar { display: none; }

  .sidebar .photo {
    width: 120px;
    height: 120px;
    margin: 0;
    flex-shrink: 0;
  }

  .sidebar-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .sidebar .name { font-size: 1.15rem; white-space: normal; }
  .sidebar .tagline { font-size: 0.85rem; white-space: normal; margin-bottom: 0.5rem; }

  .topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    justify-content: center;
    background: var(--main-bg);
    border-bottom: none;
    border-radius: 0;
    margin: 0;
    padding: 8px 1rem;
    z-index: 55;
  }
  .topnav::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0;
    border-bottom: 1px solid var(--border);
  }

  .topnav a { font-size: 1rem; padding: 0.45rem 0.7rem; }

  .main { padding: 1.5rem; }
}
