:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: dark only;
  color: rgb(156, 252, 255);
  background-color: #181818;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cursorhighlight {
  background-color: #252525;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

@font-face {
  font-family: 'LoveLetterTW';
  src: url('/assets/LoveLetterTW.woff2') format('woff2');
  font-display: swap;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: sans-serif, Avenir, Helvetica, Arial, system-ui;
  background-color: #181818;
  color: rgb(156, 252, 255);
  overflow-x: hidden;
}

body h1 {
  font-family: LoveLetterTW, sans-serif, Avenir, Helvetica, Arial, system-ui;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s, background-color 0.2s;
}
button:hover {
  border-color: #646cff;
}
button:focus,
button:focus-visible {
  outline: 4px auto -webkit-focus-ring-color;
}

#root {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.1rem;
  text-align: center;
}

.card {
  padding: 2em;
}

#headtext {
  top: 0;
  left: 0;
  width: 100%;
  margin: 0;
  padding: 1rem 0;
  text-align: center;
  transition: filter 0.15s ease-out;
}

/* App layout */
.app-container {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

/* Sidebar navigation */
.post-index-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  border-right: 1px solid #5b5b5b;
  background: #181818;
  padding: 10px 8px;
  overflow-y: auto;
  z-index: 100;
  box-sizing: border-box;
}

.post-index-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-index-sidebar > ul > li {
  font-family: LoveLetterTW, sans-serif, Avenir, Helvetica, Arial, system-ui;
  font-size: 0.9em;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.post-index-sidebar > ul > li > span {
  font-family: sans-serif, Avenir, Helvetica, Arial, system-ui;
}

.post-index-sidebar li:hover {
  background-color: #222 !important;
}

.post-index-sidebar li.active {
  background-color: #262626;
}

.tag-select {
  width: 100%;
  padding: 6px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 4px;
  color: ghostwhite;
  font-family: inherit;
  font-size: 0.85em;
  box-sizing: border-box;
}

/* Main blog container */
.blog-post {
  flex: 1;
  min-width: 0;
  margin-left: 220px;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.post-renderer-container {
  width: 100%;
  max-width: 1080px;
  min-width: 0;
  margin: 0 auto;
  font-family: sans-serif, Avenir, Helvetica, Arial, system-ui;
  text-align: left;
  box-sizing: border-box;
  transition: filter 0.12s ease-in;
}

.post-renderer-container hr {
  margin: 0.6rem 0 1.2rem 0;
  border: 0;
  border-top: 1px solid #5b5b5b;
  filter: opacity(0.4);
}

.post-renderer-container h1 {
  color: rgb(251, 192, 255);
  font-family: LoveLetterTW, sans-serif, Avenir, Helvetica, Arial, system-ui;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-top: 0.8em;
  margin-bottom: 0.4em;
}

.post-renderer-container h2 {
  color: lightskyblue;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin-top: 1.2em;
  margin-bottom: 0.4em;
}

.post-renderer-container h3 {
  color: skyblue;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

.post-renderer-container h4 {
  color: cyan;
  margin-block-start: 0.5em;
  margin-block-end: 0.5em;
}

.post-renderer-container p {
  line-height: 1.65;
  margin: 0.8em 0;
}

.post-renderer-container ul {
  list-style: none;
  padding: 0;
  margin: 0.8em 0;
  display: flex;
  flex-direction: column;
}

.post-renderer-container ul li {
  display: flex;
  align-items: baseline;
  text-align: left;
  margin: 0.25em 0;
}

.post-renderer-container ul li::before {
  content: "\2022";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  margin-right: 6px;
  color: rgb(156, 252, 255);
}

.post-renderer-container ul li > * {
  text-align: left;
}

.post-renderer-container ul li > code {
  padding-left: 0.3rem;
}

/* Code Blocks & Inline Code */
.post-renderer-container pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #282c34;
  border-radius: 6px;
  border: 1px solid #333;
  margin: 1.2em 0;
  box-sizing: border-box;
}

.post-renderer-container pre code {
  display: block;
  padding: 1em !important;
  overflow-x: auto;
  max-width: 100%;
  font-size: 0.9em;
  line-height: 1.5;
  text-align: left;
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
  box-sizing: border-box;
}

.post-renderer-container code:not(pre code) {
  background-color: #252525;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Post footer */
.post-footer {
  margin-top: 2.5em;
  padding-top: 0.5em;
}

.post-footer p {
  margin: 0;
  font-size: 0.85em;
}

/* Bluesky embed */
.bluesky-embed {
  justify-content: center;
  display: inline-flex !important;
  margin: 1em 0;
}

/* Animations */
@keyframes smoothFilter {
  0% {
    filter: blur(0.5px) hue-rotate(0deg);
  }
  10% {
    filter: blur(0.8px) hue-rotate(-30deg) saturate(1.2);
  }
  20% {
    filter: blur(0.6px) hue-rotate(-30deg) saturate(1.2);
  }
  40% {
    filter: blur(0.8px) hue-rotate(20deg) saturate(1.4);
  }
  50% {
    filter: blur(0.6px) hue-rotate(15deg) saturate(1.5);
  }
  60% {
    filter: blur(1.05px) hue-rotate(0deg) saturate(1.4);
  }
  75% {
    filter: blur(1.66px) hue-rotate(-20deg) saturate(1.3);
  }
  90% {
    filter: blur(1.33px) hue-rotate(-10deg) saturate(1.2);
  }
  100% {
    filter: blur(1px) hue-rotate(0deg) saturate(1.1);
  }
}

@keyframes hrBlur {
  from {
    filter: blur(0.1px) opacity(0.4);
  }
  to {
    filter: blur(6.9px) opacity(0.69);
  }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 769px) {
  #headtext {
    animation: smoothFilter 44s infinite alternate ease-in-out;
  }
  .post-renderer-container hr:first-of-type {
    animation: hrBlur 30s ease-in-out infinite alternate;
    animation-delay: 5s;
  }
  .post-renderer-container .post-footer hr {
    animation: none;
    animation-delay: 0s;
  }
}

/* Mobile & Tablet Drawer Responsive Design */
.toggle-sidebar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1002;
    width: 38px;
    height: 38px;
    padding: 0;
    background: rgba(24, 24, 24, 0.85);
    border: 1px solid rgba(138, 251, 255, 0.35);
    color: rgb(156, 252, 255);
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .toggle-sidebar:hover {
    background: rgba(36, 36, 36, 0.95);
    border-color: rgba(138, 251, 255, 0.6);
  }

  .toggle-sidebar.open {
    background: rgba(45, 45, 45, 0.95);
    border-color: rgba(138, 251, 255, 0.7);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .post-index-sidebar {
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    padding: 60px 12px 20px 12px;
    z-index: 1001;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.7);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
  }

  .post-index-sidebar.active {
    transform: translateX(0);
    visibility: visible;
  }

  .blog-post {
    margin-left: 0;
    padding: 3.8rem 1rem 2rem 1rem;
    width: 100%;
  }

  .post-renderer-container {
    padding: 0 0.25rem;
  }

  .post-renderer-container pre code {
    font-size: 0.82em;
    padding: 0.8em 0.6em !important;
  }

  body.sidebar-open .blog-post {
    filter: blur(1px) brightness(0.85);
    transition: filter 0.2s ease-out;
  }
}

/* Atom One Dark Theme for Highlight.js */
pre code.hljs {
  display: block;
  overflow-x: auto;
  padding: 1em;
}
code.hljs {
  padding: 3px 5px;
}
.hljs {
  color: #abb2bf;
  background: #282c34;
}
.hljs-comment,
.hljs-quote {
  color: #5c6370;
  font-style: italic;
}
.hljs-doctag,
.hljs-formula,
.hljs-keyword {
  color: #c678dd;
}
.hljs-deletion,
.hljs-name,
.hljs-section,
.hljs-selector-tag,
.hljs-subst {
  color: #e06c75;
}
.hljs-literal {
  color: #56b6c2;
}
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string,
.hljs-regexp,
.hljs-string {
  color: #98c379;
}
.hljs-attr,
.hljs-number,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-pseudo,
.hljs-template-variable,
.hljs-type,
.hljs-variable {
  color: #d19a66;
}
.hljs-bullet,
.hljs-link,
.hljs-meta,
.hljs-selector-id,
.hljs-symbol,
.hljs-title {
  color: #61aeee;
}
.hljs-built_in,
.hljs-class .hljs-title,
.hljs-title.class_ {
  color: #e6c07b;
}
.hljs-emphasis {
  font-style: italic;
}
.hljs-strong {
  font-weight: 700;
}
.hljs-link {
  text-decoration: underline;
}