body {
  font-family: 'Quattrocento Sans';
  margin: 10px;
  padding: 10px;
  background: url("old_mathematics.png")
}

/* Paper viewer layout */
.paper-viewer-body {
  margin: 0;
  padding: 0;
  background: url("old_mathematics.png");
}

.paper-viewer-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.paper-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(13, 16, 22, 0.75);
  backdrop-filter: blur(3px);
  color: #d9dde6;
  position: sticky;
  top: 0;
  z-index: 5;
}

.paper-viewer-back {
  display: inline-block;
  color: #f4f7ff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: bold;
}

.paper-viewer-back:hover {
  background: rgba(255, 255, 255, 0.12);
}

.paper-viewer-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  opacity: 0.9;
}

.paper-viewer-scroll {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 28px 14px;
}

.paper-page {
  width: min(900px, 100%);
  background: #fff;
  color: #1f2328;
  border: 1px solid #d2d4d8;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    0 2px 5px rgba(0, 0, 0, 0.2);
  padding: clamp(22px, 4vw, 62px);
  line-height: 1.58;
  text-align: justify;
  text-justify: inter-word;
}

.paper-page h1,
.paper-page h2,
.paper-page h3,
.paper-page h4 {
  font-family: 'Quattrocento', serif;
  color: #0d1118;
}

.paper-page pre,
.paper-page code {
  white-space: pre-wrap;
  word-break: break-word;
}

.paper-page img {
  max-width: 100%;
  height: auto;
}

.paper-table-wrap {
  position: relative;
}

.paper-table-open-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: #161a20;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.paper-table-wrap:hover .paper-table-open-btn,
.paper-table-open-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.paper-page table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}

.paper-page table.table-tight {
  font-size: 0.92em;
}

.paper-page table.table-very-tight {
  font-size: 0.84em;
}

.paper-page table.table-scaled {
  zoom: var(--table-scale, 1);
  overflow-x: hidden;
}

@supports not (zoom: 1) {
  .paper-page table.table-scaled {
    transform: scale(var(--table-scale, 1));
    transform-origin: top left;
  }
}

.paper-page th,
.paper-page td {
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

.paper-table-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: clamp(8px, 2vw, 24px);
  background: rgba(0, 0, 0, 0.66);
}

.paper-table-modal.open {
  display: flex;
}

.paper-table-modal-dialog {
  width: min(1500px, 100%);
  height: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
}

.paper-table-modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #d8dce4;
  background: #f4f6f9;
  padding: 10px 12px;
}

.paper-table-modal-title {
  color: #1a2029;
  font-size: 13px;
  font-weight: 700;
}

.paper-table-modal-close {
  border: 1px solid #b4bcc8;
  border-radius: 4px;
  background: #fff;
  color: #1a2029 !important;
  padding: 3px 10px;
  font-size: 13px;
  cursor: pointer;
}

.paper-table-modal-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.paper-table-modal-scroll table {
  zoom: 1 !important;
  transform: none !important;
  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;
}

@supports not (zoom: 1) {
  .paper-table-modal-scroll table {
    transform: none !important;
  }
}

.paper-table-modal-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .paper-viewer-scroll {
    padding: 8px;
  }

  .paper-page {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    width: 100%;
    padding: 18px 14px;
  }

  .paper-viewer-label {
    font-size: 12px;
  }

  .paper-table-open-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

main {
  padding-right: 0.6em;
}

h1 {
  font-family: 'Quattrocento';
}

nav {
  display: inline;
  position: static;
  height: auto;
  padding: 0;
  background: none;
  box-shadow: none;
  z-index: auto;
  transition: none;
  transform-style: flat;
}

nav .cv-links {
  font-size: 0.82em;
  color: #888;
}

nav .cv-links a {
  color: inherit;
}

nav .cv-links a:hover {
  color: #666;
}

.spiel {
  text-align: justify;
  text-justify: inter-word;
}

.headshot {
  opacity: 0.9;
  width: 200px;
  max-width: 100%;
}

.headshot-container {
  position: relative;
  display: inline-block;
}

.third-900:has(.headshot-container) {
  align-self: center;
}

.headshot-change-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(192, 192, 192, 0.9);
  border: 1px solid;
  border-color: #fff #808080 #808080 #fff;
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.headshot-change-btn:hover {
  opacity: 1;
}

.headshot-change-btn:active {
  border-color: #808080 #fff #fff #808080;
}

dl {
  margin: 0;
  padding: 0;
}

dt {
  display: inline;
  font-weight: bold;
}

dd {
  display: inline;
  margin: 0;
}

dd::after {
  display: block;
  content: "";
  margin-bottom: 6px;
}

/* Extended paper list styles */
.year-group {
  display: flex;
  border-top: 1px solid #000;
}

.year-group:last-child {
  border-bottom: 1px solid #000;
}

.year-label {
  width: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #000;
}

.year-label span {
  transform: rotate(-90deg);
  white-space: nowrap;
  font-family: 'Quattrocento', serif;
  font-weight: bold;
  font-size: 14px;
}

.year-papers {
  flex: 1;
  padding: 4px 0;
}

.year-papers ul {
  margin: 0;
  padding: 0;
}

.year-papers li {
  list-style-type: none;
  padding: 2px 8px;
}

.venue-divider {
  border: none;
  border-top: 1px dashed #000;
  margin: 4px 8px;
}

.venue-section {
  scroll-margin-top: 20px;
}

.venue-section.highlight {
  animation: highlight-flash 1.5s ease-out;
}

.paper-award {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #333;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  vertical-align: middle;
  transform: translateY(-2px);
}

@keyframes highlight-flash {
  0% { background: rgba(80, 150, 220, 0.4); }
  100% { background: transparent; }
}

.email-graph {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
}

/* Paper summary table styles */
.paper-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.6);
}

.paper-summary-table th,
.paper-summary-table td {
  padding: 4px 6px;
  text-align: center;
  border: 1px solid #ccc;
}

.paper-summary-table thead th {
  background: rgba(60, 60, 60, 0.85);
  color: #fff;
  font-family: 'Quattrocento', serif;
  font-weight: bold;
}

.paper-summary-table tbody tr:nth-child(even) {
  background: rgba(240, 240, 240, 0.5);
}

.paper-summary-table tbody tr:hover {
  background: rgba(200, 220, 255, 0.5);
}

.paper-summary-table .venue-cell {
  text-align: left;
  font-weight: bold;
  white-space: nowrap;
  background: rgba(80, 80, 80, 0.1);
  min-width: 120px;
  padding-right: 16px;
}

.paper-summary-table .has-papers {
  background: rgba(100, 180, 100, 0.25);
  font-weight: bold;
}

.paper-summary-table .clickable-cell:hover {
  background: rgba(80, 150, 220, 0.5);
  text-decoration: underline;
}

.paper-summary-table .total-col {
  background: rgba(60, 60, 60, 0.1);
  font-weight: bold;
  border-left: 2px solid #666;
}

.paper-summary-table thead .total-col {
  background: rgba(60, 60, 60, 0.85);
  border-left: 2px solid #999;
}

.paper-summary-table tfoot td {
  background: rgba(60, 60, 60, 0.85);
  color: #fff;
  font-weight: bold;
  border-top: 2px solid #666;
}

.paper-summary-table tfoot .grand-total {
  background: rgba(40, 40, 40, 0.95);
  font-size: 14px;
}

.paper-summary-table .footer-label-cell {
  text-align: right;
  white-space: nowrap;
  padding-right: 8px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: normal;
  gap: 6px;
}

.toggle-switch input {
  display: none;
}

.toggle-text {
  color: #fff;
}

.toggle-slider {
  width: 32px;
  height: 18px;
  background: #666;
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #4a4;
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(14px);
}

/* Dark mode */
.dark-mode {
  color: #e0e0e0;
  background: none;
}

.dark-mode::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("old_mathematics.png");
  filter: invert(1) sepia(0.1) saturate(6) hue-rotate(200deg);
  z-index: -1;
}


.dark-mode h1, .dark-mode h2, .dark-mode h3 {
  color: #fff;
}

.dark-mode a {
  color: #6dd5ed;
}

.dark-mode a:hover {
  color: #c6ffdd;
}

.dark-mode nav .cv-links {
  color: #8e8e8e;
}

.dark-mode nav .cv-links a:hover {
  color: #b0b0b0;
}

.dark-mode .paper-summary-table {
  background: rgba(30, 30, 50, 0.9);
}

.dark-mode .paper-summary-table tbody tr:nth-child(even) {
  background: rgba(50, 50, 70, 0.5);
}

.dark-mode .paper-summary-table tbody tr:hover {
  background: rgba(80, 100, 140, 0.5);
}

.dark-mode .paper-summary-table .venue-cell {
  background: rgba(60, 60, 80, 0.5);
}

.dark-mode .year-group {
  border-color: #444;
}

.dark-mode .year-label {
  border-color: #444;
}

.dark-mode .venue-divider {
  border-color: #444;
}

.dark-mode .paper-award {
  background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #1a1a1a;
}

.dark-mode .headshot {
  opacity: 0.85;
}

.dark-mode #email-graph {
  filter: invert(1) hue-rotate(180deg);
}

body.matrix-mode #email-graph {
  filter: invert(1) sepia(1) saturate(20) hue-rotate(70deg) brightness(0.8);
}

/* Dark mode toggle button */
#name-div {
  position: relative;
}

#dark-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 4px;
  color: #333;
}

#dark-toggle:hover {
  opacity: 1;
}

.dark-mode #dark-toggle {
  color: #ffd700;
}

/* Cite link styles */
.cite-link {
  font-size: 11px;
  color: #666;
  text-decoration: none;
  margin-left: 4px;
}

.cite-link:hover {
  color: #333;
  text-decoration: underline;
}

.dark-mode .cite-link {
  color: #aaa;
}

.dark-mode .cite-link:hover {
  color: #6dd5ed;
}

/* Inline bibtex display (revealed by clicking [bibtex]) */
.bibtex-block {
  position: relative;
  margin: 6px 0 10px 0;
}

.bibtex-block pre {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.bibtex-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  color: #444;
  cursor: pointer;
}

.bibtex-copy:hover {
  background: #fff;
  color: #000;
}

.dark-mode .bibtex-block pre {
  background: rgba(30, 30, 30, 0.7);
  border-color: #555;
  color: #ddd;
}

.dark-mode .bibtex-copy {
  background: rgba(50, 50, 50, 0.85);
  border-color: #666;
  color: #ccc;
}

.dark-mode .bibtex-copy:hover {
  background: #333;
  color: #fff;
}
