html {
  scroll-behavior: smooth;
}
/* Theme transitions - applies to all elements that change with theme */
[data-ux-theme] *,
[data-ux-theme] *::before,
[data-ux-theme] *::after {
  transition: 
    color 2s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 2s cubic-bezier(0.22, 1, 0.36, 1),
    background 2s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 2s cubic-bezier(0.22, 1, 0.36, 1),
    filter 2s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 2s cubic-bezier(0.22, 1, 0.36, 1);
}
html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../social_preview_tolmix.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  filter: blur(20px);
  z-index: -3;
  pointer-events: none;
}
html::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  opacity: 0.825;
  z-index: -2;
  pointer-events: none;
}
/* Light mode: white overlay with reduced opacity */
html[data-ux-theme="light"]::after {
  background: #fff;
}

body {
  font-family: 'Courier New', monospace;
  font-size: 1.125rem;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  line-height: 1.6;
  color: #fff;
  background: #000;
  position: relative;
}
/* Light mode: readable dark text on light background */
[data-ux-theme="light"] body {
  color: #1a1a1a;
  background: #fafafa;
  /* font-weight: 700; */
}
@media (max-width: 768px) {
  body {
    font-size: 0.9rem;
    padding: 1rem;
  }
}
@media (max-width: 480px) {
  body {
    font-size: 0.8rem;
    padding: 0.75rem;
  }
}
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background-image:
    repeating-linear-gradient(rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%);
  background-size: 1ch calc(1em * 1.6);
  mask-image: 
    linear-gradient(to top, transparent 0%, black 10%, black 90%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  mask-composite: intersect;
  -webkit-mask-image: 
    linear-gradient(to top, transparent 0%, black 10%, black 90%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  pointer-events: none;
}
/* Light mode: dark grid lines on light background */
[data-ux-theme="light"] body::before {
  background-image:
    repeating-linear-gradient(rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 100%);
}
h1 {
  font-size: 2.25em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  cursor: pointer;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
@media (max-width: 768px) {
  h1 {
    font-size: 1.75em;
  }
}
@media (max-width: 480px) {
  h1 {
    font-size: 1.5em;
  }
}
h1 a {
  color: inherit;
  text-decoration: none;
  display: block;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
h1:hover,
h1:hover a {
  color: rgba(255, 255, 255, 0.8);
  padding-left: 0.25rem;
}
h1:active,
h1:active a {
  color: rgba(255, 255, 255, 0.6);
}
/* Light mode: dark text with hover states */
[data-ux-theme="light"] h1,
[data-ux-theme="light"] h1 a {
  color: #1a1a1a;
}
[data-ux-theme="light"] h1:hover,
[data-ux-theme="light"] h1:hover a {
  color: rgba(0, 0, 0, 0.7);
}
[data-ux-theme="light"] h1:active,
[data-ux-theme="light"] h1:active a {
  color: rgba(0, 0, 0, 0.5);
}
h2 {
  font-size: 1.75em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  cursor: pointer;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
@media (max-width: 768px) {
  h2 {
    font-size: 1.5em;
    margin-top: 1.25em;
  }
}
@media (max-width: 480px) {
  h2 {
    font-size: 1.25em;
    margin-top: 1em;
  }
}
h2 a {
  color: inherit;
  text-decoration: none;
  display: block;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
h2:hover,
h2:hover a {
  color: rgba(255, 255, 255, 0.8);
  padding-left: 0.5rem;
}
h2:active,
h2:active a {
  color: rgba(255, 255, 255, 0.6);
}
/* Light mode: dark text with hover states */
[data-ux-theme="light"] h2,
[data-ux-theme="light"] h2 a {
  color: #1a1a1a;
}
[data-ux-theme="light"] h2:hover,
[data-ux-theme="light"] h2:hover a {
  color: rgba(0, 0, 0, 0.7);
}
[data-ux-theme="light"] h2:active,
[data-ux-theme="light"] h2:active a {
  color: rgba(0, 0, 0, 0.5);
}
p { 
  margin: 1em 0; 
  text-align: justify; 
  position: relative;
}
/* Light mode: thicker paragraphs with text-stroke (exclude paragraphs with strong) */
[data-ux-theme="light"] p:not(.no-text-stroke) {
  -webkit-text-stroke-width: 1px;
  -webkit-text-stroke-color: rgba(26, 26, 26, 0.8);
  text-stroke-width: 1px;
  text-stroke-color: rgba(26, 26, 26, 0.8);
}
blockquote { 
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 3px solid #666;
  font-style: italic;
}
/* Light mode: dark border and text with text-stroke */
[data-ux-theme="light"] blockquote {
  border-left-color: #999;
  color: #2d2d2d;
  -webkit-text-stroke-width: 1px;
  -webkit-text-stroke-color: rgba(45, 45, 45, 0.8);
  text-stroke-width: 1px;
  text-stroke-color: rgba(45, 45, 45, 0.8);
}
hr { margin: 2.5em 0; border: none; border-top: 1px solid #666; }
/* Light mode: lighter border */
[data-ux-theme="light"] hr {
  border-top-color: #ccc;
}
strong { font-weight: bold; }
em { font-style: italic; }
.signature {
  text-align: right;
}
.home-link {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.home-link:hover {
  color: rgba(255, 255, 255, 0.7);
  opacity: 0.8;
}
/* Light mode: dark links */
[data-ux-theme="light"] .home-link {
  color: #1a1a1a;
}
[data-ux-theme="light"] .home-link:hover {
  color: rgba(0, 0, 0, 0.6);
}
.toc {
  position: fixed;
  left: 2rem;
  top: 3rem;
  max-width: 300px;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: bold;
  line-height: 1.8;
  z-index: 5;
}
@media (min-width: 1600px) {
  .toc {
    font-size: 0.875rem;
  }
}
.toc-title {
  font-size: 1rem;
  font-weight: bold;
  font-style: italic;
  margin-bottom: 0.75rem;
  margin-top: 0.75rem;
  color: rgba(255, 255, 255, 1);
  padding-left: 1rem;
}
/* Light mode: dark TOC text with thicker font */
[data-ux-theme="light"] .toc-title {
  color: rgba(0, 0, 0, 1);
  font-weight: 700;
}
.toc-title:first-child {
  margin-top: 0;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid rgba(255, 255, 255, 1.0);
  padding-left: 1rem;
}
/* Light mode: dark TOC border */
[data-ux-theme="light"] .toc ol {
  border-left-color: rgba(0, 0, 0, 1.0);
}
.toc li {
  margin-bottom: 0.5rem;
}
.toc a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-style: italic;
  transition: color 0.2s ease, padding-left 0.2s ease;
  display: block;
  cursor: pointer;
}
.toc a:hover {
  color: rgba(255, 255, 255, 1);
  padding-left: 0.25rem;
}
.toc a:active {
  color: rgba(255, 255, 255, 0.9);
}
/* Light mode: dark TOC links with thicker font */
[data-ux-theme="light"] .toc a {
  color: rgba(0, 0, 0, 0.8);
  /* font-weight: 700; */
  -webkit-text-stroke-width: 0.25px;
  -webkit-text-stroke-color: rgba(0, 0, 0, 0.8);
  text-stroke-width: 0.25px;
  text-stroke-color: rgba(0, 0, 0, 0.8);
}
[data-ux-theme="light"] .toc a:hover {
  color: rgba(0, 0, 0, 1);
}
[data-ux-theme="light"] .toc a:active {
  color: rgba(0, 0, 0, 0.9);
}
.home-preview {
  position: absolute;
  top: 5rem;
  right: 2.5rem;
  width: 220px;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s;
  z-index: 10;
}
.home-preview:hover {
  border: 1px solid rgba(255, 255, 255, 0.4);
}
/* Light mode: dark border */
[data-ux-theme="light"] .home-preview {
  border-color: rgba(0, 0, 0, 0.7);
}
[data-ux-theme="light"] .home-preview:hover {
  border-color: rgba(0, 0, 0, 0.4);
}
.home-preview img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 1023px) {
  .home-preview {
    display: none;
  }
}
@media (max-width: 1439px) {
  .toc {
    display: none;
  }
}
@media (max-width: 1200px) {
  html, body {
    overflow-x: hidden;
  }
}

.murmuration::before,
.second-invention::before,
.mighty-stylus::before,
.incantations::before,
.suggestions::before {
  content: "";
  position: absolute;
  right: -215px;
  top: -100px;
  width: 400px;
  height: 300px;
  background-position: right;
  background-repeat: no-repeat;
  opacity: 0.3;
  z-index: -1;
  transform: rotate(5deg);
  filter: invert(1);
  animation-duration: 30s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
/* Left side images: positioned from left edge */
.first-invention::before,
.lang-latents::before,
.interpretation::before,
.contributions::before,
.creation-of-worlds::before {
  content: "";
  position: absolute;
  left: -225px;
  top: -100px;
  width: 400px;
  height: 300px;
  background-position: left;
  background-repeat: no-repeat;
  z-index: -1;
  transform: rotate(-5deg);
  filter: invert(1);
  animation-duration: 30s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
/* Individual image properties */
.murmuration::before {
  background-image: url('tree.webp');
  background-size: 200px;
  animation-name: glitchRight;
}
.first-invention::before {
  background-image: url('tablet.webp');
  background-size: 200px;
  opacity: 0.2;
  animation-name: glitchLeft;
}
.second-invention::before {
  background-image: url('network.webp');
  background-size: 200px;
  opacity: 0.5;
  animation-name: glitchRight;
}
.lang-latents::before {
  background-image: url('latent.webp');
  background-size: 200px;
  opacity: 0.4;
  filter: invert(1) grayscale(100%);
  animation-name: glitchLeft;
}
.mighty-stylus::before {
  background-image: url('stylus.webp');
  background-size: auto 150px;
  right: -150px;
  opacity: 0.45;
  filter: invert(1) grayscale(100%);
  animation-name: glitchRight;
}
.incantations::before {
  background-image: url('lean.webp');
  background-size: 150px;
  right: -175px;
  opacity: 0.25;
  filter: invert(1);
  animation-name: glitchRight;
}
.interpretation::before {
  background-image: url('rose.webp');
  background-size: 200px;
  opacity: 0.25;
  filter: grayscale(100%) brightness(1.5);
  animation-name: glitchLeft;
}
.contributions::before {
  background-image: url('caution.webp');
  background-size: 125px;
  left: -200px;
  opacity: 0.125;
  filter: grayscale(100%) brightness(1.25);
  animation-name: glitchLeft;
}
.suggestions::before {
  background-image: url('raised.webp');
  background-size: 175px;
  right: -175px;
  opacity: 0.3;
  filter: grayscale(100%);
  animation-name: glitchRight;
}
.creation-of-worlds::before {
  background-image: url('worlds.webp');
  background-size: 300px;
  left: -300px;
  opacity: 0.3;
  filter: grayscale(100%);
  animation-name: glitchLeft;
}

/* Light mode: opacity adjustments for decorative images */
[data-ux-theme="light"] .murmuration::before {
  opacity: 0.3;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .first-invention::before {
  opacity: 0.2;
  filter: grayscale(100%) invert(1);
}
[data-ux-theme="light"] .second-invention::before {
  opacity: 0.5;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .lang-latents::before {
  opacity: 0.3;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .mighty-stylus::before {
  opacity: 0.3;
}
[data-ux-theme="light"] .incantations::before {
  opacity: 0.4;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .interpretation::before {
  opacity: 0.2;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .contributions::before {
  opacity: 0.2;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .suggestions::before {
  opacity: 0.25;
  filter: grayscale(100%);
}
[data-ux-theme="light"] .creation-of-worlds::before {
  opacity: 0.4;
  filter: grayscale(100%) invert(1);
}

/* Simplified glitch animations - only rotate and scale */
/* Right side images: positive rotation */
@keyframes glitchRight {
  0% { transform: rotate(5deg) scale(1); }
  10% { transform: rotate(6.5deg) scale(1.01); }
  20% { transform: rotate(3.5deg) scale(0.99); }
  30% { transform: rotate(6deg) scale(1.008); }
  40% { transform: rotate(4deg) scale(0.992); }
  50% { transform: rotate(7deg) scale(1.012); }
  60% { transform: rotate(3deg) scale(0.988); }
  70% { transform: rotate(6.2deg) scale(1.005); }
  80% { transform: rotate(4.8deg) scale(0.995); }
  90% { transform: rotate(6.8deg) scale(1.008); }
  100% { transform: rotate(5deg) scale(1); }
}
/* Left side images: negative rotation */
@keyframes glitchLeft {
  0% { transform: rotate(-5deg) scale(1); }
  10% { transform: rotate(-3.5deg) scale(1.01); }
  20% { transform: rotate(-6.5deg) scale(0.99); }
  30% { transform: rotate(-4deg) scale(1.008); }
  40% { transform: rotate(-6deg) scale(0.992); }
  50% { transform: rotate(-3deg) scale(1.012); }
  60% { transform: rotate(-7deg) scale(0.988); }
  70% { transform: rotate(-4.8deg) scale(1.005); }
  80% { transform: rotate(-6.2deg) scale(0.995); }
  90% { transform: rotate(-3.8deg) scale(1.008); }
  100% { transform: rotate(-5deg) scale(1); }
}
/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .murmuration::before,
  .first-invention::before,
  .second-invention::before,
  .lang-latents::before,
  .mighty-stylus::before,
  .interpretation::before,
  .incantations::before,
  .contributions::before,
  .suggestions::before,
  .creation-of-worlds::before {
    animation: none;
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: fixed;
  top: 44px;
  right: 80px;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  transition: all 0.2s ease;
  padding: 0;
  opacity: 0.5;
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}
.theme-toggle-btn:active {
  transform: scale(0.95);
}
.theme-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  color: rgba(255, 255, 255, 0.9);
}
.theme-toggle-btn .moon-icon {
  display: none;
}
.theme-toggle-btn .sun-icon {
  display: block;
}
/* Light mode button styles */
[data-ux-theme="light"] .theme-toggle-btn {
  border-color: rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.3);
}
[data-ux-theme="light"] .theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(0, 0, 0, 0.5);
}
[data-ux-theme="light"] .theme-icon {
  color: rgba(0, 0, 0, 0.9);
}
[data-ux-theme="light"] .theme-toggle-btn .moon-icon {
  display: block;
}
[data-ux-theme="light"] .theme-toggle-btn .sun-icon {
  display: none;
}
/* Dark mode button icon visibility */
[data-ux-theme="dark"] .theme-toggle-btn .moon-icon {
  display: none;
}
[data-ux-theme="dark"] .theme-toggle-btn .sun-icon {
  display: block;
}
@media (max-width: 1023px) {
  .theme-toggle-btn {
    top: 1rem;
    right: 1rem;
  }
}
