/* Variables */
:root {
  --font-family-tt: "Inconsolata", monospace;
  --font-family-body: "Menlo", monospace;
  --font-family-mono: "Menlo", monospace;
  --font-size: 15px;
  --line-height: 1.725;

  /* Spacing tokens */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Colors — dark (default) */
  --color-background: #181818;
  --color-surface: #1e1e1e;
  --color-link: rgba(212, 28, 70, 1);
  --color-text: #b9babc;
  --color-light: #cccccc;
  --color-lightest: #dedede;
  --color-accent: #5bac4a;
  --color-muted: #666;

  /* Solar images */
  --sun-image: url(/images/sun.webp);
  --earth-image: url(/images/earth.webp);
  --jupiter-image: url(/images/jupiter.webp);
  --mars-image: url(/images/mars.webp);
  --shadow-image: url(/images/shadow.webp);
}


/* Reset */
*, *:before, *:after {
  box-sizing: border-box;
}

html {
  height: 100%;
  border-top: 0px solid var(--color-text);
  background-color: var(--color-background);
  scroll-behavior: smooth;
}

body {
  color: var(--color-text);
  background-color: var(--color-background);
  font-size: var(--font-size);
  font-family: var(--font-family-body);
  font-weight: 400;
  line-height: var(--line-height);
  text-rendering: geometricPrecision;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
  height: auto;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Content */
.content {
  flex: 1;
  max-width: 50rem;
  width: 100%;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

.content p {
  hyphens: auto;
}

.content pre,
.content code {
  hyphens: manual;
}

.content a {
  text-decoration: none;
  color: var(--color-text);
  background-repeat: repeat-x;
  background-position: bottom;
  background-size: 100% 6px;
  background-image: linear-gradient(transparent, transparent 4px, var(--color-text) 4px, var(--color-text));
}

.content a:hover {
  background-image: linear-gradient(transparent, transparent 4px, var(--color-link) 50px, var(--color-link));
}

.content a.icon {
  background: none;
}

.content a.icon:hover {
  color: var(--color-link);
}

.content span {
  color: #5bac4a;
}

.content h1 a, .content h2 a, .content h3 a,
.content h4 a, .content h5 a, .content h6 a {
  color: inherit;
  text-decoration: none;
  background: none;
}

.content h1 a:hover, .content h2 a:hover, .content h3 a:hover,
.content h4 a:hover, .content h5 a:hover, .content h6 a:hover {
  background: none;
}

/* Layout */
@media (min-width: 540px) {
  .image-wrap {
    flex-direction: row;
    margin-bottom: 2rem;
  }
  .image-wrap .image-block {
    margin-right: 2rem;
    flex: 1 0 35%;
  }
  .image-wrap p {
    flex: 1 0 65%;
  }
}

.width {
  width: 100%;
  max-width: 50rem;
}

@media (max-width: 480px) {
  .px3 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .my4 {
    margin-top: 2rem;
    margin-bottom: 2rem;
  }
  .content {
    padding-bottom: 60px;
  }
}

@media (min-width: 480px) {
  p {
    text-align: justify;
  }
}

/* Typography */
h1, .h1 {
  letter-spacing: 0.01em;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-style: normal;
  font-weight: 700;
  color: var(--color-accent);
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
  display: block;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

#writing .h1 {
  font-weight: 300;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
}

h1 a, .h1 a {
  color: var(--color-accent);
  text-decoration: none;
  background: none;
}

h1 a:hover, .h1 a:hover {
  background: none;
}

h2, .h2 {
  position: relative;
  font-size: 1rem;
  font-weight: bold;
  text-transform: none;
  letter-spacing: normal;
  margin-top: 0.0rem;
  margin-bottom: 0.5rem;
  color: var(--color-lightest);
  display: block;
}

h3 {
  font-size: 0.9rem;
  font-weight: bold;
  text-decoration: underline;
  color: var(--color-lightest);
}

h4, h5, h6 {
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--color-light);
  border-bottom: 1px dashed var(--color-light);
  display: inline;
  text-decoration: none;
}

h3, h4, h5, h6 {
  margin-top: 0.9rem;
  margin-bottom: 0.5rem;
}

hr {
  border: 1px dashed var(--color-light);
}

strong {
  font-weight: bold;
}

em, cite {
  font-style: italic;
}

sup, sub {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.2em;
}

small {
  font-size: 0.85em;
}

acronym, abbr {
  border-bottom: 1px dotted;
}

ul, ol, dl {
  line-height: var(--line-height);
  padding-left: 0.8rem;
}

ul ul, ul ol, ol ul, ol ol {
  margin-top: 0;
  margin-bottom: 0;
}

ol {
  list-style: decimal;
}

dt {
  font-weight: bold;
}

table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
  text-align: left;
  background: #2a2a2d;
}

th {
  font-size: 14px;
  font-weight: bold;
  color: var(--color-lightest);
  border-bottom: 1px dashed #ccc;
  padding: 8px 8px;
}

td {
  border-bottom: none;
  padding: 9px 8px 0px 8px;
}

/* Header */
#header {
  max-width: 710px;
  width: 100%;
  margin: 14vh auto 3rem 0;
  padding-left: 0;
  text-align: left;
}

/* Page Header Spacer - maintains space for solar banner */
.page-header-spacer {
  height: 14vh;
  max-width: 50rem;
  width: 100%;
  margin: 0 auto;
}

/* Post Header - same position as home header */
.post-header {
  max-width: 710px;
  width: 100%;
  margin: 14vh auto 2rem 0;
  padding-left: 0;
  text-align: left;
}

#header {
  position: relative;
}

#header #header-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  color: inherit;
  text-decoration: none;
  background: none;
}

#header h1, #header .h1 {
  letter-spacing: 0.01em;
  font-size: 1.2rem;
  line-height: 2rem;
  font-style: normal;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: 0;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
}

#header #home-link {
  color: var(--color-text);
  text-decoration: none;
}

#header #home-link:hover {
  color: var(--color-accent);
}

#header #logo {
  display: inline-block;
  width: 50px;
  height: 50px;
  background-repeat: no-repeat;
  background-size: 50px 50px;
  border-radius: 50%;
  -webkit-filter: grayscale(100%);
  filter: grayscale(0%);
  flex-shrink: 0;
  margin-right: 12px;
}

.logo-wrapper {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
}

.logo-wrapper:hover {
  transform: scale(1.15);
}

.logo-wrapper:hover #logo {
  filter: grayscale(0%) !important;
}

#header #title h1 {
  white-space: nowrap;
  pointer-events: none;
}

#header:hover #logo {
  -webkit-filter: none;
  filter: none;
}

/* Logo Bounce Animation */
.logo-bounce {
  animation: logoBounce 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes logoBounce {
  0% {
    transform: translateY(0);
  }
  15% {
    transform: translateY(-120px);
  }
  25% {
    transform: translateY(0);
  }
  32% {
    transform: translateY(-60px);
  }
  38% {
    transform: translateY(0);
  }
  43% {
    transform: translateY(-30px);
  }
  47% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
  53% {
    transform: translateY(0);
  }
  56% {
    transform: translateY(-8px);
  }
  58% {
    transform: translateY(0);
  }
  60% {
    transform: translateY(-4px);
  }
  61% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
}

/* Index */
#sociallinks {
  display: inline-block;
  list-style: none;
  padding: 0;
  margin: 0;
}

#sociallinks li {
  display: inline-block;
}

#sociallinks li:after {
  content: ", ";
}

#sociallinks li:last-child:after {
  content: "";
}

#sociallinks li:nth-last-child(2):after {
  content: " and ";
}

#writing .post-list {
  padding-left: 0;
}

.post-list {
  padding: 0;
}

.post-list .post-item {
  list-style-type: none;
  margin-left: 0;
  margin-bottom: var(--space-4);
  position: relative;
  padding-left: var(--space-0);
  transition: transform 0.2s ease, color 0.2s ease;
}

.post-list .post-item::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0.45em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.post-list .post-item:hover {
  transform: translateX(4px);
}

.post-list .post-item:hover::before {
  opacity: 1;
  transform: scale(1);
}

.post-list .post-item .meta {
  display: inline-block;
  font-size: 14px;
  color: var(--color-muted);
  margin-right: 16px;
  font-family: var(--font-family-tt);
}

@media (min-width: 480px) {
  .post-list .post-item {
    margin-bottom: var(--space-2);
    display: block;
  }
  .post-list .post-item .meta {
    display: inline-block;
    width: 100px;
    text-align: left;
    margin-right: 0;
    vertical-align: top;
  }
  .post-list .post-item > span:last-child {
    display: inline-block;
    width: calc(100% - 110px);
    vertical-align: top;
  }
}

@media (max-width: 480px) {
  .post-list .post-item {
    margin-bottom: var(--space-3);
  }
  .post-list .post-item .meta {
    font-size: 0.8rem;
  }
}

.project-list {
  padding: 0;
  list-style: none;
}

.project-list .project-item {
  margin-bottom: 5px;
}

.post-list .post-item > span > a {
  background: none !important;
  background-image: none !important;
  text-decoration: none;
}

.post-list .post-item > span > a:hover {
  background: none !important;
  background-image: none !important;
  text-decoration: none;
}

/* Article */
.article-content {
  animation: fadeInDrop 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(-20px);
}

@keyframes fadeInDrop {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

article header .posttitle {
  margin-top: 0;
  margin-bottom: 0;
  text-transform: none;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.35;
  text-wrap: pretty;
}

article header .meta {
  margin-top: 0;
  margin-bottom: 1rem;
}

article header .meta * {
  color: var(--color-light);
  font-size: 0.75rem;
}

article header .author {
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: 700;
}

article header .postdate {
  display: inline;
}

article .content h2 {
  padding-left: 1.0rem;
  position: relative;
}

article .content h2:before {
  content: "#";
  color: var(--color-accent);
  position: absolute;
  left: 0.0rem;
  top: -2px;
  font-size: 1.2rem;
  font-weight: bold;
}

article .content img, article .content video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
  border-radius: 8px;
}

article .content img {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

article .content img.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* 占位符样式 */
article .content img[data-src] {
  background: linear-gradient(90deg, #2a2a2a 0%, #3a3a3a 50%, #2a2a2a 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.video-container {
  position: relative;
  padding-top: 56.25%;
  height: 0;
  overflow: hidden;
}

.video-container iframe, .video-container object, .video-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin-top: 0;
}

article .content blockquote {
  background: inherit;
  color: #ccffb6;
  border-left: 0px solid #ccc;
  margin: 0.0rem 1px;
  padding: 0.0em 1px;
  quotes: "\201C" "\201D" "\2018" "\2019";
}

article .content blockquote p {
  margin: 0;
}

article .content blockquote:before {
  color: #ccffb6;
  content: "\201C";
  font-size: 2em;
  line-height: 0.1em;
  margin-right: 0.25em;
  vertical-align: -0.4em;
}

article .content blockquote footer {
  color: #666;
  font-size: 11px;
  margin: line-height 0;
}

article .content blockquote footer a {
  color: #666;
  background-image: linear-gradient(transparent, transparent 5px, #666 5px, #666);
}

article .content blockquote footer a:hover {
  color: #999;
  background-image: linear-gradient(transparent, transparent 4px, #999 4px, #999);
}

article .content blockquote footer cite:before {
  content: "—";
  padding: 0 0.5em;
}

article .content .pullquote {
  text-align: left;
  width: 45%;
  margin: 0;
}

article .content .pullquote.left {
  margin-left: 0.5em;
  margin-right: 1em;
}

article .content .pullquote.right {
  margin-right: 0.5em;
  margin-left: 1em;
}

article .content .caption {
  color: color-grey;
  display: block;
  font-size: 0.9em;
  margin-top: 0.5em;
  position: relative;
  text-align: center;
}

.posttitle {
  text-transform: none;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.25;
  text-wrap: pretty;
}

.article-tag .tag-link:before {
  content: "#";
}

@media (min-width: 480px) {
  .article-tag {
    display: inline;
  }
  .article-tag:before {
    content: "|";
  }
}

@media (max-width: 480px) {
  article .content {
    padding-bottom: 60px;
  }
}

/* Post Navigation */
#post-nav {
  display: flex;
  justify-content: space-between;
  max-width: 710px;
  width: 100%;
  margin: 4rem auto;
  padding: 0;
}

.post-nav-link {
  color: var(--color-text);
  text-decoration: none;
  padding: 1rem 1.5rem;
  border: 1px dotted var(--color-light);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.post-nav-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(91, 172, 74, 0.1);
}

.post-nav-link.prev {
  margin-right: 1rem;
}

.post-nav-link.next {
  margin-left: auto;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
}

@media (max-width: 480px) {
  #post-nav {
    flex-direction: column;
    gap: 1rem;
  }

  .post-nav-link {
    text-align: center;
    width: 100%;
  }

  .post-nav-link.prev {
    margin-right: 0;
  }
}

/* Code Highlighting - Monokai Sublime style */
code[class*="language-"],
pre[class*="language-"] {
  color: #f8f8f2;
  text-shadow: 0 1px rgba(0, 0, 0, 0.3);
  font-family: "Consolas", "Monaco", "Andale Mono", "Ubuntu Mono", monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 4;
  hyphens: none;
}

pre[class*="language-"] {
  padding: 1em;
  margin: .5em 0;
  overflow: auto;
  border-radius: 0.3em;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
  background: #272822;
}

:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #75715e;
}

.token.punctuation {
  color: #f8f8f2;
}

.token.namespace {
  opacity: .7;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
  color: #f92672;
}

.token.boolean,
.token.number {
  color: #ae81ff;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #a6e22e;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
  color: #f8f8f2;
}

.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
  color: #e6db74;
}

.token.keyword {
  color: #66d9ef;
}

.token.regex,
.token.important {
  color: #fd971f;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

/* Background */
.background {
  width: 100%;
  z-index: 20;
}

.small {
  max-width: 130px;
  margin: 20px auto;
  border-width: 2px;
  border-color: #fff;
  font-weight: 100;
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--color-accent);
  z-index: 300;
  width: 0%;
  transition: width 0.1s linear;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-light);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
}

.back-to-top.visible {
  opacity: 0.5;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  opacity: 1;
  color: var(--color-accent);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* Footer */
#footer {
  padding: var(--space-5) var(--space-4);
  text-align: center;
  color: var(--color-muted);
  font-size: 12px;
}

#footer a {
  color: var(--color-muted);
  text-decoration: none;
  background: none;
}

#footer a:hover {
  color: var(--color-accent);
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

/* Tablet and below (max-width: 768px) */
@media (max-width: 768px) {
  :root {
    --font-size: 14px;
  }

  /* Reduce header spacing */
  #header {
    margin: 18vh auto 2rem 0;
  }

  .page-header-spacer {
    height: 15vh;
  }

  .post-header {
    margin: 24vh auto 1.5rem 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Smaller logo on mobile */
  #header #logo {
    width: 45px;
    height: 45px;
    background-size: 45px 45px;
  }

  #header h1, #header .h1 {
    font-size: 0.9rem;
  }

  /* Adjust banner height */
  .banner-wrapper {
    height: 20vh;
  }

  .blogtitel {
    font-size: 14px;
  }

  /* Reduce content padding */
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  h1, .h1 {
    font-size: 1.3em;
    margin-top: 2rem;
  }

  h2 {
    font-size: 0.95rem;
  }

  h3 {
    font-size: 0.85rem;
  }

  /* Table scroll on mobile */
  .content table {
    display: block;
    overflow-x: auto;
  }
}

/* Small mobile (max-width: 480px) */
@media (max-width: 480px) {
  :root {
    --font-size: 13px;
  }

  /* Minimal header */
  #header {
    margin: 16vh auto 1.5rem 0;
  }

  .page-header-spacer {
    height: 12vh;
  }

  .post-header {
    margin: 17vh auto 1rem 0;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  /* Even smaller logo */
  #header #logo {
    width: 38px;
    height: 38px;
    background-size: 38px 38px;
    margin-right: 10px;
  }

  #header h1, #header .h1 {
    font-size: 0.825rem;
    line-height: 1.5rem;
  }

  /* Smaller banner */
  .banner-wrapper {
    height: 15vh;
  }

  .blogtitel {
    font-size: 12px;
    padding: 1%;
  }

  /* Content adjustments */
  .content {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.7rem;
  }

  /* Post list on mobile - keep date and title on same line */
  .post-list .post-item {
    margin-bottom: 0.375rem;
  }

  .post-list .post-item .meta {
    display: inline-block;
    margin-right: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .post-list .post-item > span:last-child {
    display: inline-block;
    width: auto;
  }

  /* Post title */
  .posttitle {
    font-size: clamp(1.3rem, 5vw, 1.6rem);
  }

  /* Smaller blockquote */
  article .content blockquote:before {
    font-size: 1.5em;
  }

  /* Post navigation */
  #post-nav {
    margin: 2rem auto;
  }

  /* Footer */
  #footer {
    padding: 15px;
    font-size: 11px;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
  }
}

/* Large tablet / small desktop (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  #header {
    margin: 17vh auto 2.5rem 0;
  }

  .page-header-spacer {
    height: 17vh;
  }

  .post-header {
    margin: 17vh auto 2rem 0;
  }
}
