:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --line: #cfcac2;
  --line-soft: #e8e3db;
  --text: #151515;
  --text-soft: #2c2c2c;
  --muted: #68635c;
  --accent: #064fb7;
  --accent-soft: #eef4ff;
  --button-bg: #fafafa;
  --badge-dark: #333333;
  --badge-blue: #3d78c4;
  --badge-red: #c43d3d;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151719;
  --surface: #1b1f24;
  --line: #3d424a;
  --line-soft: #2b3037;
  --text: #f4f2ee;
  --text-soft: #dedbd4;
  --muted: #aaa39a;
  --accent: #8bb8ff;
  --accent-soft: rgba(139, 184, 255, 0.14);
  --button-bg: #20252b;
  --badge-dark: #454b54;
  --badge-blue: #356eac;
  --badge-red: #a94242;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

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

p {
  margin-bottom: 0.56rem;
}

strong {
  color: var(--text);
  font-weight: 700;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 30;
  background: var(--text);
  color: var(--bg);
  padding: 0.45rem 0.65rem;
}

.skip-link:focus {
  top: 1rem;
}

.page-shell {
  width: min(980px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 2.3rem 0 3rem;
}

.profile-hero {
  padding-bottom: 1.25rem;
  scroll-margin-top: 1rem;
}

.profile-hero h1 {
  margin: 0 0 0.28rem;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: clamp(2.7rem, 6.4vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 0.96;
}

.profile-subtitle {
  margin: 0 0 2.15rem;
  color: var(--text-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.3;
}

.intro-grid {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.author-avatar {
  width: 124px;
  height: 124px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  object-fit: cover;
}

.intro-copy {
  min-width: 0;
}

.intro-copy p {
  max-width: 780px;
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.55;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  margin: 0.35rem 0 0.34rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1rem;
  border-radius: 2px;
  color: #ffffff;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.16rem 0.38rem;
}

.badge:hover {
  color: #ffffff;
  text-decoration: none;
  filter: brightness(1.05);
}

.badge-dark {
  background: var(--badge-dark);
}

.badge-blue {
  background: var(--badge-blue);
}

.badge-red {
  background: var(--badge-red);
}

.motto {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  min-height: 1.92rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--button-bg);
  color: var(--text-soft);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.42rem 0.85rem;
}

.profile-links a::before {
  content: "◎";
  color: var(--accent);
  font-size: 0.7rem;
  margin-right: 0.32rem;
}

.profile-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.section {
  padding-top: 2.45rem;
  scroll-margin-top: 1rem;
}

.section h2 {
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 2rem;
  font-weight: 760;
  line-height: 1.15;
  padding-bottom: 0.38rem;
}

.academic-list {
  display: grid;
  gap: 0;
}

.academic-item {
  display: grid;
  grid-template-columns: 5.8rem 13.2rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 1.05rem 0;
}

.item-date {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.66rem;
  line-height: 1.45;
  white-space: normal;
}

.item-logo {
  display: grid;
  place-items: center;
  width: 13.2rem;
  min-height: 5rem;
  background: transparent;
  padding: 0;
}

.item-logo img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 5rem;
  object-fit: contain;
}

.wide-logo {
  min-height: 3.8rem;
}

.wide-logo img {
  width: 100%;
  max-height: none;
}

.item-logo:not(.wide-logo) img {
  width: 5rem;
  height: 5rem;
  max-height: none;
}

.item-content {
  min-width: 0;
}

.item-content h3,
.item-title {
  display: block;
  margin: 0 0 0.12rem;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
}

.item-content p,
.item-place {
  display: block;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.38;
}

.clickable-item {
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.clickable-item summary {
  display: grid;
  grid-template-columns: 5.8rem 13.2rem minmax(0, 1fr) 3.8rem;
  gap: 1rem;
  align-items: center;
  min-height: 5.9rem;
  cursor: pointer;
  list-style: none;
  padding: 1.05rem 0;
}

.project-item summary {
  grid-template-columns: 5.8rem minmax(0, 1fr) 3.8rem;
}

.clickable-item summary::-webkit-details-marker {
  display: none;
}

.clickable-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.clickable-item:hover .item-title {
  text-decoration: underline;
}

.summary-action {
  justify-self: end;
  color: var(--muted);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 0.74rem;
  white-space: nowrap;
}

.summary-action::before {
  content: "More ▾";
}

.clickable-item[open] .summary-action::before {
  content: "Less ▴";
}

.details-body {
  margin: -0.2rem 0 0.95rem calc(5.8rem + 13.2rem + 2rem);
  border-top: 1px dashed var(--line-soft);
  padding-top: 0.55rem;
}

.project-item .details-body {
  margin-left: 5.8rem;
}

.details-body ul {
  margin: 0;
  padding-left: 1rem;
}

.details-body li {
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.52;
  margin-bottom: 0.28rem;
}

.details-body li::marker {
  color: var(--accent);
}

.details-body li:last-child {
  margin-bottom: 0;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.small-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--button-bg);
  color: var(--text-soft);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.3rem 0.6rem;
}

.small-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.page-footer {
  width: min(980px, calc(100% - 1.2rem));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 0.95rem 0 1.7rem;
  text-align: left;
}

.page-footer p {
  margin: 0;
  font-size: 0.8rem;
}

@media (max-width: 680px) {
  body {
    font-size: 13px;
  }

  .page-shell,
  .page-footer {
    width: min(100% - 1rem, 980px);
  }

  .intro-grid {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
  }

  .author-avatar {
    width: 92px;
    height: 92px;
  }

  .profile-hero h1 {
    font-size: 3rem;
  }

  .academic-item,
  .clickable-item summary,
  .project-item summary {
    grid-template-columns: 1fr;
    gap: 0.34rem;
  }

  .item-logo {
    width: 10rem;
    min-height: 4.8rem;
  }

  .item-logo:not(.wide-logo) img {
    width: 4.8rem;
    height: 4.8rem;
  }

  .summary-action {
    justify-self: start;
  }

  .details-body,
  .project-item .details-body {
    margin-left: 0;
  }
}
