:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-alt: #eef3f2;
  --text: #17201d;
  --muted: #5d6864;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --rule: #d8ded9;
  --gold: #b7791f;
  --shadow: 0 18px 48px rgba(23, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(216, 222, 217, 0.85);
  background: rgba(247, 244, 238, 0.9);
  backdrop-filter: blur(14px);
}

.nav,
main,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a[aria-current="page"] {
  color: var(--accent-dark);
  font-weight: 800;
}

.hero {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.58fr);
  align-items: center;
  gap: 4rem;
  padding: 4.5rem 0 4rem;
}

.page-hero {
  padding: 5rem 0 4.2rem;
  border-bottom: 1px solid var(--rule);
}

.page-hero h1 {
  max-width: 760px;
}

.longform {
  max-width: 850px;
  margin: 0 auto;
  padding: 5rem 0;
}

.longform-header {
  padding-bottom: 2rem;
}

.longform .hero-text {
  max-width: 760px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-weight: 700;
}

.article-meta span {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}

.article-figure {
  margin: 0 0 3rem;
}

.article-figure img {
  width: 100%;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-figure figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.algorithm-box {
  margin: 1.5rem 0;
  padding: 1.15rem;
  border: 1px solid rgba(226, 241, 233, 0.18);
  border-radius: 8px;
  background: #13211d;
  color: #f6fbf8;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.algorithm-box code {
  display: block;
  color: #f6fbf8;
  font-family: Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre;
}

.longform section {
  padding: 2rem 0;
  border-top: 1px solid var(--rule);
}

.longform h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.75rem, 3vw, 2.4rem);
}

.longform p,
.longform li {
  color: var(--muted);
  font-size: 1.06rem;
}

.longform a {
  color: var(--accent-dark);
  font-weight: 800;
}

.longform li + li {
  margin-top: 0.5rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.78rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1.2rem;
  font-size: clamp(3rem, 7vw, 5.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 3.4vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.1rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.hero-text {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.1rem, 1.8vw, 1.32rem);
}

.hero-actions,
.contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.button,
.contact-bar a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.button.secondary,
.contact-bar a {
  background: transparent;
  color: var(--accent-dark);
}

.button:hover,
.contact-bar a:hover {
  transform: translateY(-1px);
  transition: transform 160ms ease;
}

.profile-panel {
  display: grid;
  gap: 1.1rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-panel img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-alt);
}

.profile-panel h2 {
  font-size: 1.25rem;
}

.profile-panel p,
.prose p,
.interest-grid p,
.timeline-item p,
.education-grid p,
.skill-groups p,
.muted {
  color: var(--muted);
}

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

.section-heading {
  display: grid;
  grid-template-columns: 0.52fr 1fr;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.8rem;
}

.prose {
  max-width: 820px;
  font-size: 1.06rem;
}

.section-intro {
  max-width: 820px;
  margin: -0.6rem 0 1.6rem;
  color: var(--muted);
}

.section-intro a {
  color: var(--accent-dark);
  font-weight: 800;
}

.interest-grid,
.education-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

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

.interest-grid article,
.education-grid article,
.publication,
.article-card,
.timeline-item,
.skill-groups,
.award-list {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.interest-grid article,
.education-grid article,
.publication,
.article-card,
.timeline-item,
.skill-groups {
  padding: 1.2rem;
}

.publication-list,
.article-list,
.feed-list,
.timeline {
  display: grid;
  gap: 0.85rem;
}

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

.article-list.compact {
  grid-template-columns: 1fr;
}

.article-card {
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.feature-card {
  border-color: rgba(15, 118, 110, 0.35);
  background: linear-gradient(180deg, #ffffff, #eef7f5);
}

.repo-toolbar {
  margin: -0.6rem 0 1.3rem;
  color: var(--muted);
}

.repo-toolbar p {
  margin-bottom: 0;
}

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

.repo-card,
.update-card,
.status-card {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  padding: 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.repo-meta,
.repo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.repo-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.publication {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.publication span,
.article-card span,
.update-card span,
.timeline-date {
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
}

.publication p,
.article-card p,
.repo-card p,
.update-card p,
.status-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.publication a,
.article-card a,
.repo-card a,
.update-card a,
.status-card a {
  color: var(--accent-dark);
  font-weight: 800;
}

.article-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.publication a {
  white-space: nowrap;
}

.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
}

.skill-groups {
  display: grid;
  gap: 0.35rem;
}

.skill-groups p {
  margin-bottom: 0;
}

.award-list {
  margin: 0;
  padding: 1.2rem 1.2rem 1.2rem 2.35rem;
  color: var(--muted);
}

.award-list li + li {
  margin-top: 0.55rem;
}

.contact-bar {
  margin-top: 0;
}

.site-footer {
  padding: 2.2rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

@media (max-width: 900px) {
  .nav {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .hero,
  .section-heading,
  .interest-grid,
  .education-grid,
  .article-list,
  .repo-grid,
  .timeline-item,
  .publication {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    gap: 2rem;
    padding-top: 3rem;
  }

  .profile-panel {
    max-width: 420px;
  }

  .publication a {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .nav-links {
    gap: 0.9rem;
    font-size: 0.88rem;
  }

  .section {
    padding: 3.4rem 0;
  }

  h1 {
    font-size: 3rem;
  }

  .longform {
    padding: 3.5rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button:hover,
  .contact-bar a:hover {
    transform: none;
  }
}
