:root {
  --bg-base: #8f8f8f;
  --bg-surface: #f6f1df;
  --bg-hover: #e8e0c7;
  --border: #24211b;
  --text-primary: #17140e;
  --text-secondary: #252016;
  --text-muted: #5d533f;
  --accent: #0a3a2d;
  --accent-dim: #6d1f12;
  --font-heading: Chicago, Charcoal, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: Monaco, "Andale Mono", "Courier New", Courier, monospace;
  --font-publication: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: Chicago, Charcoal, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sidebar-width: 240px;
  --radius: 0;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%),
    var(--bg-base);
  background-size: 4px 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.55;
  image-rendering: auto;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

#theme-toggle {
  display: none !important;
}

.layout {
  display: flex;
  min-height: calc(100vh - 2rem);
  max-width: 1000px;
  margin: 1.25rem auto;
  border: 2px solid var(--border);
  position: relative;
  background: var(--bg-surface);
  box-shadow:
    4px 4px 0 #4c4c4c,
    inset 1px 1px 0 #fffaf0,
    inset -1px -1px 0 #6f6048;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 2px solid var(--border);
  padding: 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px 4px),
    #d9d0b7;
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.sidebar-photo {
  width: 140px;
  height: 140px;
  border-radius: 0;
  border: 2px solid var(--border);
  display: block;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.1);
  box-shadow:
    2px 2px 0 #4c4c4c,
    inset 1px 1px 0 #fff8dc;
  image-rendering: auto;
}

.sidebar-name {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  line-height: 1.4;
}

.sidebar-affiliations {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.1rem;
}

.sidebar-affiliations span {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sidebar-divider {
  height: 0;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid #fff8dc;
  flex: 0 0 auto;
}

.sidebar-links {
  display: flex;
  flex-direction: row !important;
  gap: 0.55rem;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap !important;
  width: 100%;
}

.sidebar-icon-link {
  width: 42px !important;
  height: 42px !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f2e8c9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: none;
  box-shadow:
    2px 2px 0 #4c4c4c,
    inset 1px 1px 0 #fff8dc,
    inset -1px -1px 0 #7c6b4d;
}

.sidebar-icon-link:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  transform: translate(1px, 1px);
  box-shadow:
    1px 1px 0 #4c4c4c,
    inset 1px 1px 0 #fff8dc,
    inset -1px -1px 0 #7c6b4d;
  text-decoration: none;
}

.sidebar-icon-link img {
  width: 26px !important;
  height: 26px !important;
  max-width: 26px !important;
  max-height: 26px !important;
  object-fit: contain;
  display: block;
  opacity: 0.95;
  filter: grayscale(1) sepia(0.08) contrast(1.15) brightness(0.78);
}

.sidebar-automaton {
  width: 100%;
  max-width: 190px;
  margin: -0.15rem auto 0;
  padding: 0;
  opacity: 0.86;
  mix-blend-mode: multiply;
}

#cellular-automaton {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
  border: 0;
  image-rendering: pixelated;
  cursor: crosshair;
}

.sidebar-invisible-poem {
  max-width: 190px;
  margin: 0.25rem auto 0;
  color: #d9d0b7;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.46rem;
  line-height: 1.36;
  text-align: center;
  user-select: text;
}

.sidebar-invisible-poem p {
  margin: 0;
}

.invisible-poem-title {
  margin-bottom: 0.5rem !important;
}

.sidebar-poem {
  margin: 0 auto;
  width: 100%;
  max-width: 188px;
  padding: 0.85rem 0.45rem 0.65rem;
  color: #3b3024;
  font-family: Baskerville, "Libre Baskerville", "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-size: 0.58rem;
  line-height: 1.52;
  letter-spacing: 0.035em;
  text-align: left;
  background:
    radial-gradient(circle at 50% 34%, rgba(152, 129, 89, 0.1), transparent 42%),
    #eee5c7;
  border-left: 1px solid rgba(59, 48, 36, 0.22);
  border-right: 1px solid rgba(59, 48, 36, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 235, 0.75),
    1px 1px 0 rgba(76, 76, 76, 0.45);
}

.sidebar-poem figcaption {
  margin: 0 0 0.62rem;
  color: #3a2f25;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  word-spacing: 0.28em;
}

.poem-lines {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}

.poem-lines p {
  margin: 0;
  white-space: nowrap;
}

.poem-first {
  display: flex;
  align-items: flex-start;
}

.poem-dropcap {
  float: left;
  margin: 0.04rem 0.1rem 0 0;
  color: #31281f;
  font-size: 2.35rem;
  line-height: 0.76;
  font-weight: 400;
  letter-spacing: 0;
}

.poem-indent {
  padding-left: 1.85rem;
}

.poem-line-numbered {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.poem-line-number {
  margin-left: auto;
  font-size: 0.5rem;
  line-height: inherit;
}

.poem-gap {
  margin-top: 0.34rem !important;
}

.poem-star {
  margin: 0.48rem 0 0.34rem !important;
  text-align: left;
}

.poem-footer {
  display: block;
  margin-top: 0.36rem;
  color: #4a3d2f;
  font-size: 0.55rem;
  line-height: 1.05;
  text-align: center;
}

.sidebar-poem-fr {
  max-width: 194px;
  font-size: 0.43rem;
  line-height: 1.46;
  letter-spacing: 0.012em;
}

.sidebar-poem-fr figcaption {
  margin-bottom: 0.72rem;
  font-size: 0.62rem;
  font-style: italic;
  letter-spacing: 0.09em;
  word-spacing: 0.05em;
}

.sidebar-poem-fr .poem-dropcap {
  font-size: 2.25rem;
  line-height: 0.72;
}

.sidebar-poem-fr .poem-lines {
  transform: scaleX(0.98);
  transform-origin: top center;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-footer {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: center;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 1.35rem 1.6rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 5px),
    var(--bg-surface);
}

.section {
  border: 1px solid var(--border);
  background: rgba(255, 250, 235, 0.68);
  box-shadow:
    2px 2px 0 #5c5c5c,
    inset 1px 1px 0 #fff8dc,
    inset -1px -1px 0 #7c6b4d;
  padding: 0 1rem 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  color: var(--text-primary);
  margin: 0 -1rem 1rem;
  padding: 0.3rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background:
    repeating-linear-gradient(0deg, #24211b 0 1px, #39352c 1px 2px);
  color: #f6f1df;
  letter-spacing: 0.01em;
  text-transform: none;
}

.about-text p {
  color: var(--text-secondary);
  font-family: var(--font-publication);
  font-size: 0.86rem;
  line-height: 1.52;
  margin-bottom: var(--space-md);
  max-width: 42rem;
}

.about-text strong {
  color: var(--text-primary);
  font-family: var(--font-publication);
  font-weight: 700;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-md);
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.pub-group {
  margin-bottom: var(--space-xl);
}

.is-hidden {
  display: none !important;
}

.pub-group:last-child {
  margin-bottom: 0;
}

.pub-group-title,
.cv-block-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-md);
  padding-left: 0;
  border-left: 0;
}

.pub-year-group {
  margin-bottom: 1.15rem;
}

.pub-year-label {
  font-family: var(--font-publication);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  border-bottom: 0;
}

.cv-list {
  list-style: none;
}

.pub-list {
  display: block;
  list-style: disc;
  padding-left: 1.35rem;
}

.pub-item {
  display: list-item;
  padding: 0.1rem 0 0.42rem;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.pub-item:hover {
  border-color: var(--border);
}

.pub-content {
  display: block;
  font-family: var(--font-publication);
  font-size: 0.86rem;
  letter-spacing: 0;
  line-height: 1.42;
}

.pub-main {
  display: inline;
  min-width: 0;
}

.pub-title {
  color: #1a0dab;
  font-family: var(--font-publication);
  font-weight: 400;
  line-height: inherit;
  display: inline;
  font-style: normal;
}

.pub-title::after {
  content: ". ";
}

.pub-authors {
  color: #222;
  font-family: var(--font-publication);
  font-size: 0.86rem;
  line-height: inherit;
  display: inline;
}

.pub-authors::after {
  content: ". ";
}

.pub-venue {
  color: #006621;
  font-family: var(--font-publication);
  font-size: 0.86rem;
}

.pub-me {
  color: #222;
  font-weight: 700;
  text-decoration: none;
}

.pub-meta {
  display: inline;
  text-align: left;
}

.pub-note {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #006621;
  font-family: var(--font-publication);
  font-size: 0.86rem;
  white-space: normal;
}

.pub-note::after {
  content: ".";
}

#coauthor-graph {
  width: 100%;
  height: 460px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.network-note {
  margin-top: 0.65rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.network-fallback {
  padding: var(--space-md);
  color: var(--text-secondary);
}

.cv-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.cv-block {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
  padding: 0.9rem 1rem;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 0;
}

.cv-block-title {
  margin-bottom: 0;
  padding-left: 0;
  border-left: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.company-group + .company-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.company-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.45rem;
}

.company-logo {
  width: auto;
  max-width: 92px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
  opacity: 0.9;
  filter: grayscale(1) sepia(0.18) contrast(1.25);
}

.company-role-list .cv-item:first-child {
  padding-top: 0.45rem;
}

.meta-logo {
  max-width: 86px;
}

.cv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
}

.cv-item:first-child {
  padding-top: 0;
}

.cv-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.cv-details {
  color: var(--text-secondary);
  line-height: 1.5;
}

.cv-details strong {
  color: var(--text-primary);
  font-weight: 600;
}

.entry-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  opacity: 0.85;
  filter: grayscale(1) sepia(0.18) contrast(1.25);
}

.cmu-logo {
  opacity: 0.95;
}

.org-logo {
  padding: 4px;
}

.cv-bullets {
  margin-top: 0.45rem;
  padding-left: 1.1rem;
  color: var(--text-secondary);
}

.cv-bullets li + li {
  margin-top: 0.25rem;
}

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

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 3px solid var(--border);
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .sidebar-profile {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 1rem;
  }

  .sidebar-photo {
    width: 80px;
    height: 80px;
    flex: 0 0 80px;
  }

  .sidebar-spacer,
  .sidebar-footer {
    display: none;
  }

  .sidebar-poem {
    display: none;
  }

  .sidebar-automaton {
    display: none;
  }

  .sidebar-invisible-poem {
    display: none;
  }

  .content {
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

  .cv-block {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

@media (max-width: 520px) {
  .content {
    padding: 1.5rem 1rem;
  }

  .sidebar {
    padding: 1.25rem;
  }

  .pub-content {
    flex-direction: column;
  }

  .pub-meta {
    align-items: flex-start;
    text-align: left;
  }

  .cv-item {
    align-items: flex-start;
  }

  .entry-logo {
    width: 34px;
    height: 34px;
  }
}
