:root {
  --ink: #14141b;
  --paper: #ececec;
  --outline: #23232a;
  --card: rgba(255, 255, 255, 0.74);
  --theme-about: #d8e6f1;
  --theme-cv: #efe6ff;
  --theme-research: #d6efc1;
  --theme-blog: #ffeeb3;
  --theme-blog-post: #f3f4f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.45;
}

.page {
  min-height: 100vh;
  width: 100%;
  padding: 24px 22px 34px;
}

.theme-about {
  background: var(--theme-about);
}

.theme-cv {
  background: var(--theme-cv);
}

.theme-research {
  background: var(--theme-research);
  overflow-x: clip;
}

.theme-blog {
  background: var(--theme-blog);
}

.theme-blog-post {
  background: var(--theme-blog-post);
}

.container {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.site-nav {
  width: 100%;
  margin: 0 auto;
  background: #f7f7f8;
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  text-decoration: none;
  color: var(--ink);
  font-family: "Sora", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(1.3rem, 2.5vw, 2.15rem);
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
}

.nav-links a {
  color: #34343d;
  text-decoration: none;
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  font-weight: 600;
}

.nav-links a.active {
  text-decoration: underline;
  text-underline-offset: 0.28em;
}

.header-group {
  margin-top: 34px;
}

.eyebrow,
.meta-line {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #473a50;
}

.about-me-name {
  margin: 8px 0;
  font-family: "Sora", sans-serif;
  letter-spacing: 0.02em;
  line-height: 1.2em;
  font-size: clamp(2rem, 5vw, 3.9rem);
  font-weight: 700;
  color: #08000d;
}

.moustache {
  margin: 0;
  letter-spacing: 0.08em;
  line-height: 1.2em;
  font-family: "Sora", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #473a50;
}

.moustache a {
  color: #473a50;
}

h1 {
  margin: 8px 0;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 5vw, 3.9rem);
  line-height: 0.98;
}

h2 {
  margin: 0 0 12px;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.02em;
  font-size: clamp(1.35rem, 2.7vw, 2rem);
}

h3 {
  margin: 0 0 8px;
  font-family: "Sora", sans-serif;
  font-size: 1.2rem;
}

.header-group p,
.content-stack p,
.surface p,
.card p {
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  max-width: 72ch;
}

.layout-split {
  margin-top: 30px;
  display: grid;
  grid-template-columns: minmax(220px, 410px) 1fr;
  align-items: center;
  gap: clamp(20px, 3vw, 46px);
}

.content-stack {
  display: grid;
  gap: 8px;
}

.media-circle {
  border: 2px solid var(--outline);
  border-radius: 50%;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
}

.media-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  padding: 8px 12px;
  border: 1.5px solid rgba(25, 25, 29, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  font-weight: 600;
}

.surface {
  margin-top: 24px;
  border: 1.5px solid rgba(24, 24, 29, 0.18);
  border-radius: 16px;
  background: var(--card);
  padding: 18px;
}

.prose {
  max-width: 100%;
}

.prose p,
.prose li,
.prose dd {
  max-width: 100%;
}

/* ── prose rich-content elements ─────────────────── */

.prose h2 {
  margin: 2em 0 0.4em;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
}

.prose h3 {
  margin: 1.6em 0 0.35em;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
}

.prose h4 {
  margin: 1.4em 0 0.3em;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #473a50;
}

.prose hr {
  border: none;
  border-top: 1.5px solid rgba(24, 24, 29, 0.15);
  margin: 2.2em 0;
}

.prose figure {
  margin: 1.8em 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(24, 24, 29, 0.14);
}

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

.prose figcaption {
  padding: 8px 12px;
  font-size: 0.83rem;
  color: #555;
  background: rgba(255,255,255,0.6);
  border-top: 1.5px solid rgba(24, 24, 29, 0.1);
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 14px 18px;
  border-left: 4px solid #b49dcc;
  background: rgba(180, 157, 204, 0.1);
  border-radius: 0 10px 10px 0;
  font-style: italic;
}

.prose blockquote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 0.83rem;
  font-weight: 700;
  color: #555;
}

.prose aside {
  margin: 1.8em 0;
  padding: 14px 18px;
  background: rgba(255, 238, 179, 0.55);
  border: 1.5px solid rgba(24, 24, 29, 0.15);
  border-radius: 10px;
}

.prose aside strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #7a5200;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0.6em 0 1em;
}

.prose li {
  margin-bottom: 0.4em;
  line-height: 1.55;
}

.prose dl {
  margin: 0.8em 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
}

.prose dt {
  font-weight: 700;
  color: #473a50;
}

.prose dd {
  margin: 0;
}

.prose mark {
  background: #ffd97a;
  padding: 0 3px;
  border-radius: 3px;
}

.prose abbr {
  cursor: help;
  text-decoration: underline dotted rgba(24, 24, 29, 0.5);
}

.prose code {
  background: rgba(24, 24, 29, 0.07);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
  font-family: "SF Mono", "Cascadia Code", monospace;
}

.prose kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1.5px solid rgba(24, 24, 29, 0.3);
  border-radius: 5px;
  font-size: 0.82em;
  background: #fff;
  box-shadow: 0 2px 0 rgba(24, 24, 29, 0.15);
  font-family: "SF Mono", monospace;
}

.prose sup {
  font-size: 0.72em;
  line-height: 1;
}

.prose sup a {
  color: #6b4fa0;
  text-decoration: none;
  font-weight: 700;
}

.prose details {
  margin: 1.4em 0;
  border: 1.5px solid rgba(24, 24, 29, 0.16);
  border-radius: 10px;
  overflow: hidden;
}

.prose summary {
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.6);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prose summary::before {
  content: "▶";
  font-size: 0.7em;
  transition: transform 0.2s;
}

.prose details[open] summary::before {
  transform: rotate(90deg);
}

.prose details > *:not(summary) {
  padding: 0 14px 14px;
}

.prose .image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.4em 0;
}

.prose .image-grid figure {
  margin: 0;
}

.prose .image-grid img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.prose .image-grid figcaption {
  font-size: 0.76rem;
  padding: 5px 8px;
}

.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 1.4em 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(24, 24, 29, 0.14);
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose .doc-embed {
  width: 100%;
  height: 420px;
  border: 1.5px solid rgba(24, 24, 29, 0.16);
  border-radius: 12px;
  display: block;
  background: #fff;
  margin: 1em 0;
}

.prose .stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.4em 0;
}

.prose .stat-box {
  border: 1.5px solid rgba(24, 24, 29, 0.14);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255,255,255,0.6);
  text-align: center;
}

.prose .stat-box strong {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.prose .stat-box span {
  font-size: 0.8rem;
  color: #555;
}

.prose .meter-row {
  display: grid;
  gap: 10px;
  margin: 1em 0;
}

.prose .meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.prose progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: none;
  appearance: none;
  overflow: hidden;
}

.prose progress::-webkit-progress-bar {
  background: rgba(24, 24, 29, 0.1);
  border-radius: 999px;
}

.prose progress::-webkit-progress-value {
  background: #b49dcc;
  border-radius: 999px;
}

.prose .footnotes {
  margin-top: 2.4em;
  padding-top: 1.2em;
  border-top: 1.5px solid rgba(24, 24, 29, 0.15);
  font-size: 0.84rem;
  color: #555;
}

.prose .footnotes ol {
  margin: 0.4em 0 0;
  padding-left: 1.4em;
}

.prose address {
  font-style: normal;
  font-size: 0.88rem;
  color: #555;
  margin-top: 0.6em;
}

.post-toc {
  margin: 1.6em 0 0;
  padding: 14px 18px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(24, 24, 29, 0.14);
  border-radius: 12px;
}

.post-toc p {
  font-weight: 700;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #473a50;
  margin: 0 0 6px;
}

.post-toc ol {
  margin: 0;
  padding-left: 1.3em;
}

.post-toc li {
  margin-bottom: 3px;
  font-size: 0.92rem;
}

.post-toc a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post-links {
  margin-top: 20px;
}

@media (max-width: 640px) {
  .prose .image-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .prose dl {
    grid-template-columns: 1fr;
  }
}

.frame {
  overflow: hidden;
}

.frame iframe {
  width: 100%;
  min-height: calc(100vh - 230px);
  border: 0;
  display: block;
  background: #fff;
}

.stack {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stack > * {
  margin-top: 0;
}

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

.card {
  border: 1.5px solid rgba(24, 24, 29, 0.16);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(24, 24, 29, 0.18);
  text-align: left;
  vertical-align: top;
}

th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
  color: #374056;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.btn-outline {
  padding: 6px 12px;
  border: 1.5px solid var(--outline);
  color: var(--ink);
  background: #fff;
  font-size: 0.86rem;
  box-shadow: 0 2px 0 rgba(20, 20, 27, 0.16);
}

.btn-outline:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(20, 20, 27, 0.2);
}

.btn-outline:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(20, 20, 27, 0.14);
}

.btn:focus-visible {
  outline: 2px solid #5d88ff;
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .site-nav {
    border-radius: 20px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .layout-split {
    grid-template-columns: 1fr;
  }

  .media-circle {
    width: min(340px, 100%);
    margin: 0 auto;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 560px;
  }

  .theme-research .table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .frame iframe {
    min-height: 68vh;
  }
}
