@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/xcharter/XCharter-Roman.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/xcharter/XCharter-Italic.otf") format("opentype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/xcharter/XCharter-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/xcharter/XCharter-BoldItalic.otf") format("opentype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #fffdf8;
  --text: #181818;
  --muted: #626262;
  --line: #e6e1d7;
  --link: #1d4ed8;
  --max-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "XCharter", "Charter", Georgia, serif;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

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

h1,
h2,
h3 {
  font-family: "XCharter", "Charter", Georgia, serif;
}

.page {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 4rem 0 5rem;
}

.header {
  display: grid;
  gap: 0;
}

.identity {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.portrait {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f3efe6;
  margin-top: 0.15rem;
}

.header h1 {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.role,
.meta {
  color: var(--muted);
}

.meta-group {
  display: grid;
  gap: 0.1rem;
}

.meta-inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.meta-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.icon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf7f0;
}

.icon-link img {
  width: 1.1rem;
  height: 1.1rem;
}

.icon-link-small {
  width: 1.7rem;
  height: 1.7rem;
}

.icon-link-small img {
  width: 0.88rem;
  height: 0.88rem;
}

.intro,
.section {
  margin-top: 2.5rem;
}

.intro {
  display: grid;
  gap: 1rem;
}

.load-error {
  margin-top: 2rem;
  color: var(--muted);
}

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

.section h2 {
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.section-link {
  color: inherit;
  text-decoration: none;
}

.section-link:hover,
.section-link:focus-visible {
  text-decoration: none;
}

.item-list {
  display: grid;
  gap: 1.5rem;
}

.item {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.icon-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

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

.icon-item > div {
  min-width: 0;
}

.publication-item > div {
  min-width: 0;
}

.publication-copy {
  display: grid;
  gap: 0.45rem;
}

.item-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.item-logo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #f3efe6;
}

.item-logo.is-contained {
  object-fit: contain;
  padding: 0.35rem;
  background-clip: padding-box;
}

.item-logo.is-transparent {
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.publication-figure {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  display: block;
}

.project-preview-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.55rem;
}

.project-preview {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8f3ea;
  display: block;
}

.project-preview-trigger {
  display: inline-block;
  width: 5.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.project-preview-trigger:hover .project-preview,
.project-preview-trigger:focus-visible .project-preview {
  border-color: #bfae93;
}

.project-preview-trigger:focus-visible {
  outline: none;
}

.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(19, 17, 13, 0.74);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-panel {
  position: relative;
  width: min(92vw, 860px);
}

.lightbox-image {
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #f8f3ea;
  display: block;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  top: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(22, 20, 16, 0.64);
  color: #f8f3ea;
  cursor: pointer;
}

.lightbox-close {
  right: 0.8rem;
}

.lightbox-prev {
  left: 0.8rem;
  top: calc(50% - 1.125rem);
}

.lightbox-next {
  right: 0.8rem;
  top: calc(50% - 1.125rem);
}

.lightbox-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.55rem;
}

.lightbox-counter {
  margin: 0;
  color: #f8f3ea;
  font-size: 0.95rem;
}

.item h3 {
  font-size: 1.1rem;
  line-height: 1.35;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.links {
  margin-top: 0.45rem;
  color: var(--muted);
}

.links span {
  margin: 0 0.35rem;
}

@media (max-width: 640px) {
  .page {
    width: min(calc(100% - 1.25rem), var(--max-width));
    padding-top: 2.5rem;
  }

  .portrait {
    width: 72px;
    height: 72px;
    margin-top: 0.1rem;
  }

  .icon-item {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .publication-item {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .item-title-row {
    gap: 0.5rem;
  }

  .meta-inline {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .project-preview {
    width: 4.75rem;
    height: 4.75rem;
  }

  .project-preview-trigger {
    width: 4.75rem;
  }

  .lightbox {
    padding: 0.8rem;
  }

  .lightbox-close,
  .lightbox-nav {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.55rem;
  }
}
