/* Color scheme: slate neutrals, blue primary, cyan secondary. */

:root {
  --neutral: 255, 255, 255;
  --neutral-50: 248, 250, 252;
  --neutral-100: 241, 245, 249;
  --neutral-200: 226, 232, 240;
  --neutral-300: 203, 213, 225;
  --neutral-400: 148, 163, 184;
  --neutral-500: 100, 116, 139;
  --neutral-600: 71, 85, 105;
  --neutral-700: 51, 65, 85;
  --neutral-800: 30, 41, 59;
  --neutral-900: 15, 23, 42;
  --primary-100: 219, 234, 254;
  --primary-200: 191, 219, 254;
  --primary-300: 147, 197, 253;
  --primary-400: 96, 165, 250;
  --primary-500: 59, 130, 246;
  --primary-600: 37, 99, 235;
  --primary-700: 29, 78, 216;
  --primary-900: 30, 58, 138;
  --secondary-400: 34, 211, 238;
  --secondary-700: 14, 116, 144;

  --bg: rgb(var(--neutral));
  --text: rgb(var(--neutral-900));
  --muted: rgb(var(--neutral-500));
  --body: rgb(var(--neutral-700));
  --headings: rgb(var(--neutral-800));
  --bold: rgb(var(--neutral-900));
  --link: rgb(var(--primary-700));
  --link-underline: rgb(var(--primary-300));
  --link-hover-bg: rgb(var(--primary-600));
  --code: rgb(var(--secondary-700));
  --hr: rgb(var(--neutral-200));
  --border: rgb(var(--neutral-300));
  --surface: rgb(var(--neutral-100));
  --accent: rgb(var(--primary-600));
  --alert-bg: rgb(var(--primary-100));
  --alert-text: inherit;
  --quote-border: rgb(var(--primary-200));
  --bullets: rgb(var(--neutral-500));
  --toc-link: rgb(var(--neutral-700));
  --icon-link: rgb(var(--neutral-400));
  --icon-hover: rgb(var(--primary-700));

  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color-scheme: light;
}

:root.dark {
  --bg: rgb(var(--neutral-800));
  --text: rgb(var(--neutral));
  --muted: rgb(var(--neutral-400));
  --body: rgb(var(--neutral-300));
  --headings: rgb(var(--neutral-50));
  --bold: rgb(var(--neutral));
  --link: rgb(var(--primary-400));
  --link-hover-bg: rgb(var(--primary-400));
  --code: rgb(var(--secondary-400));
  --hr: rgb(var(--neutral-500));
  --border: rgb(var(--neutral-600));
  --surface: rgb(var(--neutral-700));
  --accent: rgb(var(--primary-400));
  --alert-bg: rgb(var(--primary-900));
  --alert-text: rgb(var(--neutral-300));
  --quote-border: rgb(var(--primary-900));
  --bullets: rgb(var(--neutral-600));
  --toc-link: rgb(var(--neutral-400));
  --icon-link: rgb(var(--neutral-500));
  --icon-hover: rgb(var(--primary-400));
  color-scheme: dark;
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0 auto;
  max-width: 80rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.75rem;
}
@media (min-width: 640px) {
  body { padding: 0 3.5rem; }
}
@media (min-width: 768px) {
  body { padding: 0 6rem; }
}
@media (min-width: 1024px) {
  body { padding: 0 8rem; }
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
img {
  max-width: 100%;
  height: auto;
}
h1,
h2,
h3 {
  margin: 0;
}
[hidden] {
  display: none !important;
}
main {
  flex-grow: 1;
}
.icon {
  display: inline-block;
  position: relative;
  padding: 0 0.25rem;
  vertical-align: text-bottom;
}
.icon svg {
  display: block;
  width: 1em;
  height: 1em;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -2.5rem);
  padding: 0.25rem 0.75rem;
  border-radius: 0 0 0.5rem 0.5rem;
  background: rgb(var(--primary-200));
  font-size: 0.875rem;
}
.skip-link:focus {
  transform: translate(-50%, 0);
}
.dark .skip-link {
  background: rgb(var(--neutral-600));
}

/* Header */
.site-header {
  padding: 1.5rem 0;
  font-weight: 600;
}
@media (min-width: 640px) {
  .site-header { padding: 2.5rem 0; }
}
.site-header nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.site-title:hover,
.main-menu a:hover span {
  text-decoration: underline;
  text-decoration-color: rgb(var(--primary-500));
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
.main-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.menu-button,
.menu-close {
  display: none;
}
.search-button:hover,
.menu-button:hover {
  color: var(--accent);
}
@media (max-width: 639px) {
  .menu-button {
    display: block;
  }
  .main-menu {
    position: fixed;
    inset: 0;
    z-index: 30;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    padding: 1.5rem;
    background: rgba(var(--neutral-100), 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
  }
  .dark .main-menu {
    background: rgba(var(--neutral-900), 0.5);
  }
  .main-menu.open {
    opacity: 1;
    visibility: visible;
  }
  .menu-close {
    display: block;
    margin-bottom: 0.25rem;
  }
}

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem 0;
}
.copyright {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.appearance-switcher {
  display: flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  margin-right: 3.5rem;
  font-size: 0.875rem;
}
.appearance-switcher:hover {
  color: var(--accent);
}
.when-dark,
.dark .when-light {
  display: none;
}
.dark .when-dark {
  display: inline;
}
#to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: rgba(var(--neutral), 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 1.25rem;
  color: rgb(var(--neutral-700));
}
.dark #to-top {
  background: rgba(var(--neutral-800), 0.5);
  color: rgb(var(--neutral));
}
#to-top:hover {
  color: var(--accent);
}

/* Cookie notice */
#cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  padding: 0.6rem;
  background: #464646;
  color: rgba(255, 255, 255, 0.9);
  font-size: small;
  line-height: 1.5;
  text-align: center;
}
#cookie-notice a,
#cookie-notice button {
  display: inline-flex;
  margin-left: 0.5rem;
  font-weight: 700;
}
#cookie-notice button {
  padding: 0.1rem 0.5rem;
  border-radius: 5px;
}
#cookie-notice-accept {
  background: rgba(32, 105, 213, 0.8);
}
#cookie-notice-deny {
  background: rgba(200, 91, 77, 0.8);
}
@media (max-width: 767px) {
  #cookie-notice span {
    display: block;
    margin-bottom: 0.75rem;
  }
}

/* Search */
#search-wrapper {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: rgba(var(--neutral-500), 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.dark #search-wrapper {
  background: rgba(var(--neutral-900), 0.5);
}
@media (min-width: 768px) {
  #search-wrapper { padding: 10vh; }
}
#search-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 48rem;
  min-height: 0;
  margin: 0 auto;
  border: 1px solid rgb(var(--neutral-200));
  border-radius: 0.375rem;
  background: var(--bg);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}
.dark #search-modal {
  border-color: rgb(var(--neutral-700));
}
#search-modal header {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}
#search-modal form {
  display: flex;
  flex: 1;
  align-items: center;
  color: rgb(var(--neutral-400));
}
#search-query {
  flex: 1;
  height: 3rem;
  margin: 0 0.25rem;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  appearance: none;
}
#close-search-button:hover {
  color: var(--accent);
}
#search-results {
  flex: 1 1 auto;
  overflow: auto;
  margin: 0;
  padding: 0 0.5rem;
  list-style: none;
}
#search-results li {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  background: rgb(var(--neutral-100));
}
.dark #search-results li {
  background: rgb(var(--neutral-700));
}
#search-results li:first-child {
  margin-top: 0.5rem;
}
#search-results li:has(a:focus),
#search-results li:hover {
  background: rgb(var(--primary-100));
}
.dark #search-results li:has(a:focus),
.dark #search-results li:hover {
  background: rgb(var(--primary-900));
}
#search-results a {
  flex: 1;
  padding: 0.5rem 0;
  outline: none;
}
.result-title {
  font-weight: 700;
}
.result-section,
.result-summary {
  font-size: 0.875rem;
  color: var(--muted);
}
.result-arrow {
  margin-left: 0.5rem;
}
.no-results {
  padding: 0.5rem !important;
  color: var(--muted);
}

/* Home (profile layout) */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 50vh;
  text-align: center;
}
.profile .avatar {
  width: 9rem;
  margin-bottom: 0.5rem;
  border-radius: 9999px;
}
.profile h1 {
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 800;
}
.profile h2 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 400;
  color: var(--muted);
}
.profile .author-links {
  margin-top: 0.25rem;
  font-size: 1.5rem;
}
.author-links {
  display: flex;
  flex-wrap: wrap;
  color: var(--icon-link);
}
.author-links a {
  padding: 0 0.25rem;
  transition: transform 0.15s;
}
.author-links a:hover {
  transform: scale(1.25);
  color: var(--icon-hover);
}

/* Lists */
main > header h1,
.article-header h1,
.error-title {
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 800;
  color: var(--text);
}
.section-intro {
  margin-top: 1rem;
}
.year {
  margin-top: 3rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: rgb(var(--neutral-700));
}
.dark .year {
  color: rgb(var(--neutral-300));
}
.article-list .year:first-child {
  margin-top: 2rem;
}
.year-rule {
  width: 9rem;
  margin: 0;
  border: 0;
  border-top: 1px dotted rgb(var(--neutral-400));
}
.card {
  display: flex;
  max-width: 65ch;
  margin-top: 1.5rem;
}
.card-thumb {
  flex: none;
  padding-right: 1rem;
}
.card-thumb img {
  display: block;
  width: 6rem;
  height: auto;
  border-radius: 0.375rem;
  object-fit: cover;
  aspect-ratio: 1;
}
@media (min-width: 640px) {
  .card-thumb { padding-right: 1.5rem; }
  .card-thumb img { width: 10rem; height: 10rem; }
}
.card h3 {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
}
.card h3 a {
  color: rgb(var(--neutral-800));
  text-decoration-color: rgb(var(--primary-500));
}
.dark .card h3 a {
  color: rgb(var(--neutral));
}
.card h3 a:hover {
  text-decoration-line: underline;
  text-underline-offset: 2px;
}
.card .external {
  align-self: flex-start;
  margin-left: 0.25rem;
  font-size: 0.75rem;
  color: rgb(var(--neutral-400));
  cursor: default;
}
.card-summary {
  padding: 0.25rem 0;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--body);
}
.article-meta {
  font-size: 0.875rem;
  color: var(--muted);
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  padding-top: 2.5rem;
}
.pagination > * {
  min-width: 2rem;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  text-align: center;
}
.pagination a:hover {
  background: rgb(var(--primary-600));
  color: rgb(var(--neutral));
}
.pagination [aria-current] {
  background: rgb(var(--neutral-200));
  font-weight: 700;
}
.dark .pagination [aria-current] {
  background: rgb(var(--neutral-600));
}

/* Articles */
.article-header {
  max-width: 65ch;
}
.article-header h1 {
  margin-bottom: 2rem;
}
.article-header .article-meta {
  margin-bottom: 2.5rem;
  font-size: 1rem;
}
.article-header .feature {
  display: block;
  margin-bottom: 1.5rem;
  border-radius: 0.375rem;
}
.article-body {
  display: flex;
  flex-direction: column;
}
.article-body .prose {
  min-width: 0;
  flex-grow: 1;
}
@media (min-width: 1024px) {
  .article-body.has-toc { flex-direction: row-reverse; justify-content: flex-end; }
  .article-body .toc { position: sticky; top: 2.5rem; align-self: flex-start; max-width: 20rem; padding-left: 2rem; }
  .toc summary { display: none; }
}
.toc {
  max-height: 100vh;
  overflow-y: auto;
  padding-right: 1.25rem;
  font-size: 1rem;
}
.toc details {
  overflow: hidden;
  border-radius: 0.5rem;
}
.toc summary {
  padding: 0.25rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  background: rgb(var(--neutral-100));
  color: rgb(var(--neutral-800));
}
.dark .toc summary {
  background: rgb(var(--neutral-700));
  color: rgb(var(--neutral-100));
}
.toc nav {
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 1px dotted rgb(var(--neutral-300));
}
.dark .toc nav {
  border-color: rgb(var(--neutral-600));
}
.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.375;
}
.toc li {
  margin: 0.5em 0;
}
.toc .toc-l1 {
  padding-left: 1rem;
}
.toc .toc-l2 {
  padding-left: 2rem;
}
.toc a {
  color: var(--toc-link);
}
.toc a:hover {
  color: var(--accent);
}
.article-footer {
  max-width: 65ch;
  padding-top: 2rem;
}
.author-box {
  display: flex;
}
.author-box img {
  width: 6rem;
  height: auto;
  margin-right: 1rem;
  border-radius: 9999px;
  align-self: center;
}
.author-box > div {
  place-self: center;
}
.author-label {
  font-size: 0.6rem;
  line-height: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
}
.author-name {
  font-weight: 600;
  line-height: 1.5rem;
  color: rgb(var(--neutral-800));
}
.dark .author-name {
  color: rgb(var(--neutral-300));
}
.author-bio {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: rgb(var(--neutral-700));
}
.dark .author-bio {
  color: var(--muted);
}
.article-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px dotted rgb(var(--neutral-300));
}
.dark .article-pagination {
  border-color: rgb(var(--neutral-600));
}
.article-pagination a .title {
  display: block;
  font-weight: 600;
}
.article-pagination a:hover .title {
  text-decoration: underline;
  text-decoration-color: rgb(var(--primary-500));
}
.article-pagination .next {
  text-align: right;
}
.error-code {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

/* Prose (article body typography) */
.prose {
  max-width: 65ch;
  color: var(--body);
  font-size: 1rem;
  line-height: 1.75;
}
.prose > :first-child {
  margin-top: 0;
}
.prose p {
  margin: 1.25em 0;
}
.prose a {
  color: var(--link);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
}
.prose a:hover {
  color: rgb(var(--neutral));
  text-decoration: none;
  background: var(--link-hover-bg);
  border-radius: 0.09rem;
}
.dark .prose a:hover {
  color: rgb(var(--neutral-800));
}
.prose strong {
  color: var(--bold);
  font-weight: 600;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  color: var(--headings);
}
.prose h2 {
  margin: 2em 0 1em;
  font-size: 1.5em;
  line-height: 1.3333333;
  font-weight: 700;
}
.prose h3 {
  margin: 1.6em 0 0.6em;
  font-size: 1.25em;
  line-height: 1.6;
  font-weight: 600;
}
.prose h4 {
  margin: 1.5em 0 0.5em;
  line-height: 1.5;
  font-weight: 600;
}
.heading-anchor {
  position: absolute;
  top: 0;
  left: -1.5rem;
  width: 1.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.prose .heading-anchor,
.prose .heading-anchor:hover {
  color: rgb(var(--primary-300));
  text-decoration: none;
  background: none;
}
.dark .prose .heading-anchor {
  color: rgb(var(--neutral-700));
}
.prose :is(h2, h3, h4):hover .heading-anchor {
  opacity: 1;
}
.prose ul,
.prose ol {
  margin: 1.25em 0;
  padding-left: 1.625em;
}
.prose li {
  margin: 0.5em 0;
}
.prose li::marker {
  color: var(--bullets);
}
.prose hr {
  margin: 3em 0;
  border: 0;
  border-top: 1px solid var(--hr);
}
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 1em;
  border-left: 0.25rem solid var(--quote-border);
  font-style: italic;
  font-weight: 500;
}
.prose img {
  margin: 2em 0;
  border-radius: 0.375rem;
}
.prose figure {
  margin: 2em 0;
}
.prose figure img {
  margin: 0;
}
.prose figcaption {
  margin-top: 0.85em;
  font-size: 0.875em;
  color: var(--muted);
}
.prose table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  font-size: 0.875em;
  line-height: 1.7142857;
}
.prose th {
  padding: 0 0.5714286em 0.5714286em;
  border-bottom: 1px solid rgb(var(--neutral-500));
  text-align: left;
  color: var(--headings);
  font-weight: 600;
}
.prose td {
  padding: 0.5714286em;
  border-bottom: 1px solid var(--border);
}
.prose code {
  color: var(--code);
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 600;
}
.prose code::before,
.prose code::after {
  content: "`";
}
.prose pre code::before,
.prose pre code::after {
  content: none;
}
.highlight {
  position: relative;
}
.prose pre {
  overflow-x: auto;
  margin: 1.7142857em 0;
  padding: 0.8571429em 1.1428571em;
  border-radius: 0.375rem;
  font-size: 0.875em;
  line-height: 1.7142857;
  tab-size: 4;
}
.prose pre code {
  color: inherit;
  font-size: inherit;
  font-weight: 400;
}
.copy-button {
  visibility: hidden;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  width: 5rem;
  padding: 0.25rem 0;
  border-radius: 0 0.375rem 0 0.375rem;
  background: rgb(var(--neutral-200));
  color: rgb(var(--neutral-700));
  font-family: var(--font-mono);
  font-size: 0.875rem;
  opacity: 0.9;
}
.dark .copy-button {
  background: rgb(var(--neutral-600));
  color: rgb(var(--neutral-200));
}
.highlight:hover .copy-button,
.copy-button:focus {
  visibility: visible;
}
.copy-button:hover {
  background: rgb(var(--primary-100));
}
.dark .copy-button:hover {
  background: rgb(var(--primary-600));
}

/* Shortcodes */
.alert {
  display: flex;
  margin: 1.25em 0;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  background: var(--alert-bg);
  color: var(--alert-text);
}
.alert-icon {
  padding-right: 0.75rem;
  color: rgb(var(--primary-400));
}
.attachments {
  margin: 1.25em 0;
  padding: 0.5rem 1rem;
  border: 1px solid rgb(var(--primary-300));
  border-radius: 0.375rem;
}
.attachments-label {
  font-weight: 600;
  color: var(--headings);
}
.prose .attachments ul {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

@media print {
  .site-header,
  .site-footer,
  .toc,
  .article-footer,
  #to-top,
  #cookie-notice {
    display: none !important;
  }
}
