body[a="dark"] {
  filter: invert(1);
}
body[a="dark"] img {
  filter: invert(1);
}
body[a="dark"] img.ioda {
  filter: invert(0);
}
body[a="dark"] .emoji {
  filter: invert(1);
}
body[a="dark"] iframe {
  filter: invert(1);
}

body[a="light"] {
  filter: none;
}
body[a="light"] img {
  filter: none;
}
body[a="light"] .emoji {
  filter: none;
}
body[a="light"] iframe {
  filter: none;
}

@media (prefers-color-scheme: dark) {
  body[a="auto"] {
    filter: invert(1);
  }
  body[a="auto"] img {
    filter: invert(1);
  }
  body[a="auto"] img.ioda {
    filter: invert(0);
  }
  body[a="auto"] .emoji {
    filter: invert(1);
  }
  body[a="auto"] iframe {
    filter: invert(1);
  }
}
html,
body {
  background: white;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  color: black;
  font-family: monospace;
  font-size: 16px;
  line-height: 1.4;
  margin: 0;
  min-height: 100%;
  overflow-wrap: break-word;
}

.post-meta {
  text-align: right;
}

h2,
h3,
h4,
h5,
h6 {
  margin-top: 3rem;
}

hr {
  margin: 2rem 0;
}

p {
  margin: 1rem 0;
}

li {
  margin: 0.4rem 0;
}

*:target {
  background: yellow;
}

.w {
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

hr {
  text-align: center;
  border: 0;
}
hr:before {
  content: "/////";
}
hr:after {
  content: attr(data-content) "/////";
}

table {
  width: 100%;
}

table,
th,
td {
  border: thin solid black;
  border-collapse: collapse;
  padding: 0.4rem;
}

code {
  color: white;
  background: black;
}

div.highlighter-rouge code {
  display: block;
  overflow-x: auto;
  white-space: pre-wrap;
  padding: 1rem;
}

blockquote {
  font-style: italic;
  border: thin solid black;
  padding: 1rem;
}
blockquote p {
  margin: 0;
}

img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* OpenMoji Black monochrome emoji font */
@font-face {
  font-family: "OpenMoji Black";
  src: url("/assets/fonts/OpenMoji-Black.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+203C-3299, U+1F000-1FAFF, U+1FC00-1FFFD;
}
/* Use OpenMoji automatically for emoji codepoints, keep monospace for text */
body {
  font-family: monospace, "OpenMoji Black", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  font-variant-emoji: text;
}

.emoji,
.emoji-large {
  font-family: "OpenMoji Black", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}

.emoji-large {
  font-size: 1.25em;
  line-height: 1;
}

/* License block styling: override code block colors for license text */
pre.license-text {
  background: transparent;
  color: inherit;
  border: thin solid black;
  padding: 1rem;
  white-space: pre-wrap;
}

/* Light-themed code blocks (inline and fenced) */
code {
  background: #f6f8fa;
  color: #111;
}

div.highlighter-rouge code {
  background: #f6f8fa;
  color: #111;
  border: 1px solid #e1e4e8;
}

/* Keep code blocks light even in dark appearance (theme inverts whole page) */
body[a="dark"] code,
body[a="dark"] div.highlighter-rouge code {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  body[a="auto"] code,
  body[a="auto"] div.highlighter-rouge code {
    filter: invert(1);
  }
}
/* Back-to-top button */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border: thin solid black;
  background: white;
  color: black;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

/* On wider screens, align the button to the content column's right edge */
@media (min-width: 720px) {
  .back-to-top {
    /* Place 20px to the right of the content column (includes .w padding of 2rem) */
    right: auto;
    left: calc(50% + 320px + 2rem + 20px);
  }
}
/* Theme toggle button */
.theme-toggle-button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  display: inline;
}

.theme-toggle-button:hover {
  opacity: 0.7;
}

.theme-toggle-button:focus {
  outline: 1px solid;
  outline-offset: 2px;
}

.theme-icon {
  margin-right: 0.25em;
}

/* Cookie notice */
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: thin solid black;
  padding: 1rem;
  z-index: 1000;
  display: none;
  color: black;
  font-size: 16px;
  line-height: 1.4;
  min-height: 60px;
  box-sizing: border-box;
}

.cookie-notice-content {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cookie-notice-text {
  flex: 1;
  min-width: 250px;
  margin: 0;
}

.cookie-notice-text a {
  color: black;
  text-decoration: underline;
}

.cookie-accept-button {
  background: black;
  color: white;
  border: thin solid black;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.cookie-accept-button:hover {
  background: white;
  color: black;
}

.cookie-accept-button:focus {
  outline: 2px solid;
  outline-offset: 2px;
}

/* High specificity rules to ensure cookie notice displays properly */
#cookie-notice.cookie-notice {
  display: none;
  filter: none !important;
}

#cookie-notice.cookie-notice[style*="display: block"] {
  display: block !important;
}

#cookie-notice .cookie-notice-content {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 40px !important;
  overflow: visible !important;
}

/* Ensure cookie notice content is never hidden */
body div#cookie-notice.cookie-notice div.cookie-notice-content {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 40px !important;
  overflow: visible !important;
}

/* Ultra-high specificity selectors to ensure visibility */
body div#cookie-notice.cookie-notice div.cookie-notice-content p.cookie-notice-text {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #000000 !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  font-family: monospace !important;
  height: auto !important;
  width: auto !important;
  position: static !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  text-decoration: none !important;
  text-indent: 0 !important;
}

body div#cookie-notice.cookie-notice div.cookie-notice-content button#cookie-accept.cookie-accept-button {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #ffffff !important;
  background: #000000 !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  font-family: monospace !important;
  height: auto !important;
  width: auto !important;
  position: static !important;
  margin: 0 !important;
  padding: 0.5rem 1rem !important;
  border: 1px solid #000000 !important;
  text-decoration: none !important;
  text-indent: 0 !important;
}
