:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --link: #3b82f6;
  --accent: #f4f4f4;
}

[data-theme="dark"] {
  --bg: #1e1e1e;
  --fg: #f4f4f4;
  --link: #90cdf4;
  --accent: #2d2d2d;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: sans-serif;
  line-height: 1.6;
}

.page-main{
  flex: 1;
  display: flex; 
  flex-direction: column; 
  min-height: 100vh;
}

.page-main h1 {
  text-align: right;
}

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

.logo {
  width: 3rem;
  height: auto;
  margin-right: 0.5rem;
  vertical-align: middle;
  fill: currentColor;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--accent);
  padding: 1rem;
  height: 4rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: #ccc;
  display: flex;
  align-items: center;
}

.site-title:hover {
  color: #fff;
}

[data-theme="light"] .site-title {
  color: #000;
}

[data-theme="light"] .site-title:hover {
  color: var(--link);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar a {
  color: #1a1a1a; 
  text-decoration: none;
  margin: 0 0.75rem;
  font-weight: 400;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.navbar a:hover {
  color: #000; 
}

.navbar a.active {
  color: #000;
  font-weight: bold;
}

[data-theme="dark"] .navbar a {
  color: #ccc;
}

[data-theme="dark"] .navbar a:hover {
  color: #fff;
}

[data-theme="dark"] .navbar a.active {
  color: #fff;
  font-weight: bold;
}

[data-theme="light"] .navbar a:hover {
  color: var(--link)
}

.search-container {
  display: flex;
  align-items: center;
  position: relative;
}

#search-toggle {
  all: unset;
  cursor: pointer;
  font-size: 1.2rem;
  color: inherit;
}

#search-input {
  width: 0;
  opacity: 0;
  pointer-events: none;
  border-radius: 5px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  transition: width 0.3s ease, opacity 0.3s ease, margin-left 0.3s ease;
  margin-left: 0;
}

#search-input.active {
  width: 200px;
  opacity: 1;
  pointer-events: all;
  padding: 0.4rem 0.6rem;
  margin-left: 0.5rem;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 100;
  right: 0;
  width: 200px;
  background: var(--accent);
  border: 1px solid var(--fg);
  border-radius: 5px;
  margin-top: 0.3rem;
  display: none;
  z-index: 1500;
}

.suggestion-item {
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.suggestion-item:hover {
  background: var(--link);
  color: #fff;
}

.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: inherit;
}

@media (max-width: 768px) {
  .navbar-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--accent);
    border-top: 1px solid #888;
    position: absolute;
    align-items: center;
    text-align: center;
    gap: 1rem;
    top: 4rem;
    left: 0;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .navbar-links.show {
    display: flex;
  }

  .hamburger {
    display: block;
  }

  .topbar {
    position: relative;
    flex-wrap: wrap;
    z-index: 1000;
  }
}

#menu-overlay {
  display: none;
  position: fixed;
  top: 4rem;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.3);
  z-index: 900;
}

#menu-overlay.show {
  display: block;
}

.no-scroll {
  overflow: hidden;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1rem;
  text-align: center;
}

.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 12px rgba(0, 0, 0, 0.4);
  margin-bottom: 1rem;
}

.tagline {
  font-size: 1.1rem;
  opacity: 0.8;
}

.content {
  flex: 1;
}

button#theme-toggle {
  all: unset;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  width: 1.25rem;
  color: #ccc;
}

[data-theme="light"] button#theme-toggle {
  color: #000;
}

[data-theme="light"] button#theme-toggle:hover {
  color: var(--link);
}

[data-theme="dark"] button#theme-toggle:hover {
  color: #fff;
}

.view-all-link {
  text-align: center;
  margin-top: 2rem;
}

.view-all-link a {
  font-weight: bold;
  color: #ccc;
  font-size: 1rem;
  text-decoration: none;
}

[data-theme="light"] .view-all-link a {
  color: #000;
}

.view-all-link a:hover {
  text-decoration: underline;
  color: #fff;
}

[data-theme="light"] .view-all-link a:hover {
  color: var(--link);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.post-card {
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 2rem;
}

.post-thumbnail {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.post-content {
  padding: 1.25rem;
}

.post-card h2 {
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card h2 a {
  color: #ccc;
  display: inline-block;
  word-break: break-word;
}

.post-card h2 a:hover {
  color: #fff;
}

[data-theme="light"] .post-card h2 a {
  color: #000;
}

[data-theme="light"] .post-card h2 a:hover {
  color: var(--link);
}

.post-meta {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 0.75rem;
}

.post-excerpt {
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 1rem;
}

.post-tags {
  margin-top: auto;
}

.themed-image {
  width: 100%;
  height: auto;
  transition: filter 0.3s ease;
}

[data-theme="dark"] .themed-image {
  filter: invert(93%) hue-rotate(180deg);
}

.tag {
  display: inline-block;
  background: #555;
  color: white;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.8rem;
  margin-right: 0.4rem;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

[data-theme="dark"] .tag {
  color: white;
}

[data-theme="light"] .tag {
  background: #ddd;
  color: #000;
}

.tag:hover {
  background: var(--link);
  color: #fff;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

a.tag-link {
  display: inline-block;
  background: #888;
  color: var(--fg);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  margin-right: 0.4rem;;
  transition: background 0.1s, color 0.1s;
}

a.tag-link:hover {
  background: var(--link);
  color: #fff;
}

.post-year-list {
  list-style: none;
  padding-left: 0;
}

.post-year-list li {
  display: flex;
  justify-content: space-between;
  margin: 0.4rem 0;
  font-size: 1rem;
  border-bottom: 1px dotted var(--accent);
  padding-bottom: 0.2rem;
}

.post-year-list a {
  color: var(--fg);
}

.post-year-list .post-date {
  opacity: 0.6;
  font-size: 0.9rem;
}

.about-section {
  margin-bottom: 4rem;
}

.about-section h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.about-section p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--fg);
}

.author {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}

.author img.avatar {
  width: 300px; 
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.social-links{
  margin-top: 0.5rem;
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.social-links a {
  color: var(--fg);
  font-size: 1.25rem;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--link);
}

.author-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.author .author-text {
  flex: 1;
}

.author.reverse {
  flex-direction: row-reverse;
  text-align: left;
}

@media (max-width: 768px) {
  .author,
  .author.reverse {
    flex-direction: column;
    text-align: center;
  }
  .author img.avatar {
    margin-bottom: 1rem;
  }
}

[data-theme="dark"] #scrollTopBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: none;
  background: #1a1a1a;
  color: #555;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 50%;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.3s ease, transform 0.2s ease;
}

[data-theme="light"] #scrollTopBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: none;
  background: #ccc;
  color: #888;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 50%;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.3s ease, transform 0.2s ease;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

thead {
  background: var(--accent);
}

th, td {
  border: 1px solid var(--fg);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: bold;
}

tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] #scrollTopBtn:hover {
  color: #fff;
  transform: translateY(-3px);
}

[data-theme="light"] #scrollTopBtn:hover {
  color: #1a1a1a;
  transform: translateY(-3px);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.7rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  min-height: 50px;
}

[data-theme="dark"] .site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}

.site-footer a:hover {
  text-decoration: underline;
}