:root {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --hr-color: #444444;
  --heading-border: #5f2721;
  --link-color: #c9736a;
  --link-hover: #e58378;
  --blockquote-border: #5f2721;
  --blockquote-shadow: #110d0d;
  --code-bg: #292424;
  --pre-bg: #1e1e1e;
  --pre-border: #5f2721;
  --name-color: crimson;
  --theme-toggle-bg: #973f35;
  --theme-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

[data-theme="light"] {
  --bg-color: #f8f8f8;
  --text-color: #121212;
  --hr-color: #cccccc;
  --heading-border: #d8a8a0;
  --link-color: #973f35;
  --link-hover: #bd4f42;
  --blockquote-border: #d8a8a0;
  --blockquote-shadow: #e0e0e0;
  --code-bg: #f0f0f0;
  --pre-bg: #f5f5f5;
  --pre-border: #d8a8a0;
  --name-color: #a52a2a;
  --theme-toggle-bg: #bd4f42;
  --theme-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 2em 0;
  min-height: 100vh;
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.screen {
  width: 60%;
  height: auto;
  min-height: 100%;
  margin-left: 20%;
  box-sizing: border-box;
}

header {
  margin-bottom: 1em;
}

footer {
  margin-top: 2em;
  padding-top: 1em;
  text-align: center;
}

.name {
  color: var(--name-color);
  font-weight: 700;
  font-size: 2.5em;
  display: block;
  position: relative;
  margin-bottom: 0.2em;
}

hr {
  border: 0;
  height: 1px;
  background-color: var(--hr-color);
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

h1,
h2,
h3 {
  border-bottom: solid 1px var(--heading-border);
  padding-bottom: 0.25em;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition:
    color 0.2s ease-in-out,
    background-color 0.2s ease-in-out;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

blockquote {
  border-left: solid var(--blockquote-border) 5px;
  padding: 0.5em 1em;
  margin-left: 1rem;
  margin-right: 1rem;
  box-shadow: 0 0 5px var(--blockquote-shadow);
  font-style: italic;
  background-color: color-mix(in srgb, var(--code-bg) 50%, transparent);
}

pre {
  background-color: var(--pre-bg);
  padding: 0.8em 1em;
  border: 1px solid var(--pre-border);
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9em;
  margin: 1em 0;
}

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

code {
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

img {
  opacity: 0.8;
  max-width: calc(100% - 2rem);
  margin: 1em auto;
  padding: 0;
  height: auto;
  display: block;
  border-radius: 4px;
}

nav {
  font-size: 1.1em;
  margin-top: 0.5em;
}
nav a {
  margin-right: 1.5em;
  text-transform: lowercase;
}
nav a:last-child {
  margin-right: 0;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

main section,
.intro-section,
.about-section,
.now-section {
  margin-bottom: 2em;
}

.intro-text {
  font-size: 1.2em;
  line-height: 1.6;
}

.about-section p {
  text-align: justify;
  line-height: 1.7;
}

.now-section h2 {
  margin-bottom: 0.5em;
  font-size: 1.3em;
}
.now-section ul {
  list-style-type: "- ";
  padding-left: 1.5em;
}
.now-section ul li {
  margin-bottom: 0.5em;
}

.social-links {
  text-align: center;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

.social-links svg {
  height: 1.8em;
  padding: 8px;
  transition: transform 0.2s ease-in-out;
}
html:not([data-theme="light"]) .social-links svg {
  filter: invert(100%);
}
html[data-theme="light"] .social-links svg {
  filter: none;
}
.social-links svg:hover {
  transform: scale(1.1);
}
.social-links a {
  text-decoration: none;
  display: inline-block;
}

.post-list ul {
  list-style: none;
  padding-left: 0;
}
.post-list li {
  margin-bottom: 1em;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}
.post-date {
  color: var(--text-color);
  opacity: 0.7;
  font-size: 0.9em;
  margin-right: 0.75em;
  flex-shrink: 0;
  min-width: 90px;
}
.post-list li .post-link {
  font-size: 1.1em;
}
.post-list li .post-link:hover {
  background-color: color-mix(in srgb, var(--link-hover) 15%, transparent);
  border-radius: 3px;
  padding: 0.1em 0.3em;
  margin: -0.1em -0.3em;
  text-decoration: none;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--theme-toggle-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 100;
}
.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}
.theme-toggle::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  background: var(--theme-toggle-icon) no-repeat center;
}

/* RSS Link */
.rss-link {
  display: inline-flex;
  align-items: center;
}
.rss-link svg {
  margin-right: 0.3em;
}

/* View Counter */
.view-counter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: var(--text-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.view-counter.visible {
  opacity: 0.6;
}
.view-counter:hover {
  opacity: 1;
}
.view-counter:hover::after {
  content: "Unique daily views";
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--code-bg);
  color: var(--text-color);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 10;
}
.view-icon {
  display: inline-flex;
  align-items: center;
}
.view-icon svg {
  width: 16px;
  height: 16px;
  color: var(--text-color);
}
.view-count {
  font-weight: bold;
  color: var(--text-color);
}
.view-label {
  color: var(--text-color);
}

.hljs {
  background: transparent !important;
  color: inherit !important;
}

@media only screen and (orientation: portrait),
  only screen and (max-width: 700px),
  only screen and (max-height: 700px) {
  .screen {
    font-size: 0.9rem;
    width: 90vw;
    margin-left: 5vw;
  }
}
