:root {
  --ink: #1a1a1a;
  --ink-light: #555;
  --ink-lightest: #999;
  --rule: #c8c2b8;
  --bg: #faf9f7;
  --code-bg: #efefec;
  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-ui: 'Helvetica Neue', Arial, sans-serif;
  --measure: 68ch;
  --col: 720px;
  --toggle-size: 1.1rem;
}

[data-theme="dark"] {
  --ink: #e8e4dc;
  --ink-light: #9a9488;
  --ink-lightest: #6e6a63;
  --rule: #383530;
  --bg: #181614;
  --code-bg: #232019;
}

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

html {
  font-size: 18px;
  background: var(--bg);
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}

body {
  font-family: var(--font-body)
}

.theme-toggle-wrapper {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: radial-gradient(circle 1.2rem, rgba(250, 249, 247, 1) 0%, rgba(250, 249, 247, 0.25) 55%, rgba(250, 249, 247, 0) 80%);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

[data-theme="dark"] .theme-toggle-wrapper {
  background: radial-gradient(circle 1.2rem, rgba(24, 22, 20, 1) 0%, rgba(24, 22, 20, 0.25) 55%, rgba(24, 22, 20, 0) 80%);
}

.theme-toggle-wrapper:hover {
  background: radial-gradient(circle 1.2rem, rgba(250, 249, 247, 1) 0%, rgba(250, 249, 247, 0.25) 55%, rgba(250, 249, 247, 0) 80%);
}

[data-theme="dark"] .theme-toggle-wrapper:hover {
  background: radial-gradient(circle 1.2rem, rgba(24, 22, 20, 1) 0%, rgba(26, 26, 26, 0.25) 55%, rgba(26, 26, 26, 0) 80%);
}

.theme-toggle {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  aspect-ratio: 1;
  background: var(--ink);
  border: none;
  cursor: pointer;
  padding: 0;
  color: transparent;
  font-size: 0;
  line-height: 1;
  transition: background 0.15s;
  z-index: 100;

  mask-size: 100%, 100%;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><path d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"/></svg>');
}

.theme-toggle:hover {
  border-color: var(--ink-light);
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><path d="M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"/></svg>');
}

[data-theme="dark"] .theme-toggle {
  background: var(--ink);
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><path d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"/></svg>');
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--ink-light);
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><path d="M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36c-0.98,1.37-2.58,2.26-4.4,2.26 c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"/></svg>');
}

.theme-toggle .icon-light {
  display: none;
}

.theme-toggle .icon-dark {
  display: none;
}

.paper {
  max-width: var(--col);
  margin: 0 auto;
  padding: 5rem 0 0rem;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
  text-decoration: none;
  margin-bottom: 4rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.back:hover {
  border-color: var(--ink-light);
  color: var(--ink);
}

.paper-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2.5rem;
  margin-bottom: 3rem;
  transition: border-color 0.2s;
}

h1.paper-title {
  font-family: var(--font-body);
  font-size: 2.2rem;
  font-weight: normal;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  max-width: var(--measure);
}

.paper-meta {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.paper-meta-left {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.paper-meta-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink);
  font-weight: normal;
}

.pdf-download {
  text-decoration: underline;
}

.pdf-download:hover,
.pdf-download:focus {
  color: var(--ink-light);
}

.abstract {
  margin: 2.5rem 0 3rem;
  padding: 1.5rem 2rem;
  border-left: 3px solid var(--ink);
  transition: border-color 0.2s;
}

.abstract-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.75rem;
}

.abstract p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink-light);
  max-width: var(--measure);
}

.paper-body h2 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: bold;
  margin: 3rem 0 0.75rem;
}

.paper-body h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  font-weight: normal;
  margin: 2rem 0 0.5rem;
}

.paper-body p {
  margin-bottom: 1.1rem;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s, color 0.2s;
}

.paper-body a:hover {
  color: var(--ink-light);
  text-decoration-color: var(--ink-light);
}

.paper-body ul,
.paper-body ol {
  padding-left: 2rem;
  margin-bottom: 1.1rem;
}

.paper-body li {
  margin-bottom: 0.35rem;
}

.paper-body blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-light);
  transition: border-color 0.2s;
}

.paper-body blockquote p {
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.paper-body blockquote p:last-child {
  margin-bottom: 0;
}

.math.display {
  margin: 1.5rem 0;
  padding: 0.5rem 0;
  overflow: hidden;
}

.katex-display {
  margin: 0.5em 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}

th {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.75rem;
  text-align: left;
  transition: border-color 0.2s;
}

td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s;
}

code {
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 0.82rem;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  transition: background 0.2s;
}

pre {
  background: var(--code-bg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 3px;
  transition: background 0.2s;
}

pre code {
  background: none;
  padding: 0;
}

.smallcaps {
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

.paper-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--ink-light);
  transition: border-color 0.2s;
}

.site-header {
  max-width: var(--col);
  margin: 0 auto;
  padding: 5rem 0 3.5rem;
  border-bottom: 2px solid var(--ink);
  transition: border-color 0.2s;
}

.site-title {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.site-sub {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-light);
}

.paper-list {
  max-width: var(--col);
  margin: 0 auto;
}

.card {
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s;
}

.card-link {
  display: block;
  padding: 2.5rem 0 1.75rem 0;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s;
}

.card-link:hover {
  transform: translateX(0.75rem);
}

.card-title {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: normal;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.card-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-light);
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.85rem;
}

.card-abstract {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-light);
}

.card-read {
  font-family: var(--font-ui);
  font-size: 2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.15s, border-color 0.2s;
}

hr {
  border: none;
  border-top: 2px solid var(--rule);
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  h1.paper-title {
    font-size: 1.6rem;
  }

  .paper {
    padding: 3rem 1.5rem 5rem;
  }

  .site-header {
    padding: 5rem 1.5rem 3.5rem;
  }

  .paper-list {
    padding: 0 1.5rem;
  }

  .theme-toggle-wrapper {
    top: 1rem;
    right: 1rem;
  }

  .card-link:hover {
    transform: translateX(0.5rem);
  }
}

@media (hover: none) {
  .card-link:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  html {
    transition: none !important;
  }
}

/* Footer styles */
.site-footer {
  max-width: var(--col);
  margin-top: 4rem;
  margin: 0 auto;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--ink-light);
  padding: 2rem 1rem;
  text-align: center;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-light);
  text-decoration: none;
  transition: color 0.15s, opacity 0.15s;
}

.footer-icon:hover {
  opacity: 0.7;
  color: var(--ink-lightest);
}

.footer-icon svg {
  display: block;
  height: 1.2rem;
}
