/* ==========================================================================
   Kaldorei 4.0 — Modern redesign
   Ghost 5+ · No jQuery/Bootstrap dependency · Glassmorphism header ·
   Card post list · Enhanced sidebar · Dark mode · Scroll reveal
   ========================================================================== */

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  font-family: var(--sans-serif);
  font-size: 16px;
  line-height: 1.75;
  color: var(--font-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.nav-closed {
  overflow-x: hidden;
}

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

a:hover {
  color: var(--primary-light-hover);
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--selection-color);
  color: #fff;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.container-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
  padding-top: 32px;
  padding-bottom: 64px;
}

.content {
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(100% - 340px);
}

.content-wide {
  max-width: 860px;
  margin: 0 auto;
  flex-basis: 100%;
}

/* ---------- Header / Navigation ---------- */

.main-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--header-border);
  transition: box-shadow var(--transition), background-color 0.3s ease;
}

.main-header.is-scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-height);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--font-color);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.blog-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--font-color);
  letter-spacing: -0.02em;
}

.blog-title:hover {
  color: var(--primary-color);
}

.blog-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.main-nav {
  margin-left: auto;
}

.main-nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav-menu > li > a {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--font-color);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition);
}

.main-nav-menu > li > a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary-color);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition);
}

.main-nav-menu > li > a:hover {
  color: var(--primary-color);
  background: rgba(0, 154, 97, 0.07);
}

.main-nav-menu > li > a:hover::after,
.main-nav-menu > li.nav-current > a::after {
  transform: scaleX(1);
}

.main-nav-menu > li.nav-current > a {
  color: var(--primary-color);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--font-color);
  font-size: 16px;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), transform var(--transition);
}

.header-action-btn:hover {
  background: rgba(0, 154, 97, 0.1);
  color: var(--primary-color);
}

.header-action-btn:active {
  transform: scale(0.94);
}

/* theme toggle icon swap */
.theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: none;
}

html[data-theme="dark"] .theme-icon-light {
  display: inline-block;
}

/* ---------- Post cards / list ---------- */

.featured-section {
  margin-bottom: 28px;
}

.post-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card-hero {
  display: flex;
  flex-direction: column;
}

.post-card-hero .post-card-image-link {
  display: block;
  aspect-ratio: 21 / 9;
  overflow: hidden;
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image {
  transform: scale(1.04);
}

.post-card-body {
  padding: 28px 32px 24px;
}

.post-card-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 24px;
}

.post-card-row .post-card-row-image-link {
  flex: 0 0 240px;
  min-height: 180px;
  overflow: hidden;
}

.post-card-row-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card-row:hover .post-card-row-image {
  transform: scale(1.05);
}

.post-card-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
}

.post-card-row .post-card-title {
  font-size: 20px;
}

.post-card-row .post-card-excerpt {
  -webkit-line-clamp: 2;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.post-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.post-badge-featured {
  background: rgba(255, 177, 60, 0.15);
  color: #d9820b;
}

html[data-theme="dark"] .post-badge-featured {
  background: rgba(255, 177, 60, 0.18);
  color: #ffb23c;
}

.post-card-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  background: rgba(0, 154, 97, 0.08);
  transition: background-color var(--transition), color var(--transition);
}

.post-card-tag:hover {
  background: var(--primary-color);
  color: #fff;
}

.post-card-title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: var(--font-color);
}

.post-card-title a:hover {
  color: var(--primary-color);
}

.post-card-excerpt {
  margin: 0 0 14px;
  color: var(--midgrey);
  font-size: 15px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  font-size: 13px;
  color: var(--post-meta);
}

.post-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.post-card-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--midgrey);
  font-size: 11px;
}

.post-card-readmore {
  margin-left: auto;
}

.post-card-readmore a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--primary-color);
}

.post-card-readmore a:hover i {
  transform: translateX(3px);
}

.post-card-readmore a i {
  transition: transform var(--transition);
}

/* empty state */
.post-list:empty::after {
  content: "No posts yet";
  display: block;
  padding: 60px 0;
  text-align: center;
  color: var(--midgrey);
}

/* ---------- Tag hero ---------- */

.tag-meta {
  flex-basis: 100%;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.tag-meta .page-title {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--font-color);
}

.tag-meta .page-description {
  display: block;
  margin-top: 6px;
  color: var(--midgrey);
}

/* ---------- Author page header ---------- */

.author-page-header {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.author-page-avatar img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-md);
}

.author-page-name {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.author-page-bio {
  margin: 0 0 8px;
  color: var(--midgrey);
}

.author-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--post-meta);
}

.author-page-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Sidebar & widgets ---------- */

.sidebar {
  flex: 0 0 300px;
  position: sticky;
  top: calc(var(--header-height) + 32px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--font-color);
  margin: 0 0 16px;
}

.widget-title i {
  color: var(--primary-color);
}

/* profile widget */

.widget-profile {
  text-align: center;
  padding: 0;
  overflow: hidden;
}

.widget-profile-cover {
  height: 96px;
  background-color: var(--primary-color);
  background-size: cover;
  background-position: center;
}

.widget-profile-cover.no-cover {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light-hover));
}

.widget-profile-header {
  margin-top: -36px;
  padding: 0 24px 0;
}

.widget-profile-logo {
  display: inline-block;
}

.widget-profile-logo img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.widget-profile-title {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--font-color);
}

.widget-profile-desc {
  margin: 8px 24px 0;
  color: var(--midgrey);
  font-size: 14px;
  line-height: 1.7;
}

.widget-profile-stats {
  margin: 16px 20px 0;
}

.site-stat {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
}

.site-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.site-stat-item-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.site-stat-item-name {
  font-size: 12px;
  color: var(--post-meta);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px 20px;
  margin: 0;
  list-style: none;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--midgrey);
  background: var(--surface-2);
  transition: all var(--transition);
}

.social-link:hover {
  color: #fff;
  background: var(--primary-color);
  transform: translateY(-2px);
}

/* tag cloud widget */

.tag-cloud-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--midgrey);
  background: var(--surface-2);
  transition: all var(--transition);
}

.tag-item:hover {
  color: #fff;
  background: var(--primary-color);
  transform: translateY(-2px);
}

.tag-count {
  font-size: 11px;
  opacity: 0.75;
}

/* toc widget */

.widget-toc {
  max-height: calc(100vh - var(--header-height) - 80px);
  overflow: auto;
}

/* recent comments widget */

.widget-comments {
  padding-bottom: 8px;
}

.recent-comments {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recent-comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.recent-comment-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.recent-comment-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--midgrey);
  font-size: 13px;
}

.recent-comment-body {
  flex: 1 1 auto;
  min-width: 0;
}

.recent-comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.recent-comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--font-color);
}

.recent-comment-date {
  font-size: 11px;
  color: var(--post-meta);
}

.recent-comment-text {
  margin: 2px 0 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--midgrey);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.recent-comment-text p {
  margin: 0;
  display: inline;
}

.recent-comment-post {
  font-size: 12px;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-comment-post i {
  flex: 0 0 auto;
}

.recent-comments-empty {
  margin: 0;
  padding: 12px 0;
  text-align: center;
  color: var(--post-meta);
  font-size: 13px;
}

/* archive widget */

.archive-widget-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-widget-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--font-color);
  transition: background-color var(--transition), color var(--transition);
}

.archive-widget-link:hover {
  background: var(--surface-2);
  color: var(--primary-color);
}

.archive-widget-count {
  font-size: 12px;
  color: var(--post-meta);
  font-variant-numeric: tabular-nums;
}

.archive-widget-link:hover .archive-widget-count {
  color: var(--primary-color);
}

/* stat widget */

.widget-stat .site-stat {
  border: none;
  padding: 4px 0;
}

.widget-stat .widget-title {
  margin-bottom: 8px;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 6px 0 6px 12px;
  color: var(--midgrey);
  border-left: 2px solid var(--border-color);
  transition: all var(--transition);
}

.toc a:hover {
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

.toc a.toc-active {
  color: var(--primary-color);
  font-weight: 600;
  border-left-color: var(--primary-color);
}

.toc .toc-h3 {
  padding-left: 24px;
}

.toc .toc-h4 {
  padding-left: 36px;
}

/* ---------- Post page ---------- */

.post-header {
  margin-bottom: 32px;
}

.post-feature-image {
  margin: 0 0 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.post-feature-image img {
  width: 100%;
  display: block;
}

.post-title {
  margin: 0 0 14px;
  font-size: 34px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--font-color);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--post-meta);
}

.post-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-meta-item a {
  color: var(--post-meta);
  font-weight: 500;
}

.post-meta-item a:hover {
  color: var(--primary-color);
}

/* ---------- Ghost content styles ---------- */

/* Koenig editor wide / full-width images (required by gscan) */
.kg-width-wide {
  width: min(1200px, 100vw);
  max-width: 100vw;
  margin-left: calc(50% - min(1200px, 100vw) / 2);
  margin-right: calc(50% - min(1200px, 100vw) / 2);
}

.kg-width-full {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.post-content .kg-width-wide img,
.post-content .kg-width-full img {
  width: 100%;
}

.post-content {
  font-size: 16px;
  line-height: 1.85;
}

.post-content > p {
  margin: 0 0 1.4em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 1.6em 0 0.7em;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.post-content h2 { font-size: 26px; }
.post-content h3 { font-size: 21px; }
.post-content h4 { font-size: 18px; }

.post-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0, 154, 97, 0.4);
}

.post-content a:hover {
  text-decoration-color: var(--primary-color);
}

.post-content img {
  border-radius: var(--radius-md);
}

.post-content pre {
  background: var(--linenumber-dark-bg);
  color: #e6e6e6;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
  tab-size: 4;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.post-content :not(pre) > code {
  background: rgba(0, 154, 97, 0.09);
  color: var(--primary-color);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.post-content blockquote {
  margin: 1.6em 0;
  padding: 4px 24px;
  border-left: 3px solid var(--primary-color);
  background: rgba(0, 154, 97, 0.05);
  color: var(--midgrey);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 1.6em 0;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.post-content th {
  background: var(--surface-2);
  font-weight: 600;
}

/* bookmark / gallery cards from Ghost 5 */

.kg-card {
  margin: 1.6em 0;
}

.kg-bookmark-card {
  border-radius: var(--radius-md);
}

.kg-image-gallery {
  display: grid;
  grid-auto-flow: row;
  gap: 8px;
}

/* post author footer */

.author-info {
  margin: 40px 0 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.author-info-title {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--post-meta);
  margin-bottom: 10px;
}

.author-info-bio {
  color: var(--midgrey);
}

.author-info-social {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
}

.author-info-social a {
  color: var(--primary-color);
  font-weight: 500;
}

/* post nav */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
}

.post-nav-prev,
.post-nav-next {
  max-width: 48%;
}

.post-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--font-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.post-nav a:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

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

/* ---------- Archives ---------- */

.archives-header {
  margin-bottom: 24px;
}

.archives-header .post-title {
  font-size: 30px;
}

.archives-total {
  color: var(--midgrey);
  font-size: 14px;
}

.archives-content {
  position: relative;
  padding-left: 20px;
}

.archives-content::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary-color), transparent);
}

.archives-item {
  position: relative;
  padding: 10px 0 10px 16px;
}

.archives-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary-color);
  transition: background var(--transition), transform var(--transition);
}

.archives-item:hover::before {
  background: var(--primary-color);
  transform: scale(1.25);
}

.archives-info-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.archives-date {
  font-size: 13px;
  color: var(--post-meta);
  font-variant-numeric: tabular-nums;
}

.archives-info-meta a {
  color: var(--font-color);
  font-weight: 500;
}

.archives-info-meta a:hover {
  color: var(--primary-color);
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 40px 0 16px;
  font-size: 14px;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  color: var(--font-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.pagination a:hover {
  color: #fff;
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.pagination .page-number {
  color: var(--post-meta);
}

/* ---------- Search ---------- */

.search-hint {
  padding: 24px 20px;
  text-align: center;
  color: var(--post-meta);
  font-size: 14px;
}

.search-hint code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.site-search {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 0;
}

.site-search.is-hidden {
  display: none;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 26, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.search-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: searchPanelIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes searchPanelIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.search-form .input-prefix {
  color: var(--primary-color);
  font-size: 18px;
}

.search-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 17px;
  color: var(--font-color);
  font-family: var(--sans-serif);
}

.search-field::placeholder {
  color: var(--post-meta);
}

.search-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--midgrey);
  cursor: pointer;
  transition: all var(--transition);
}

.search-close:hover {
  color: var(--font-color);
  background: var(--surface-2);
}

.search-list {
  max-height: 56vh;
  overflow-y: auto;
}

.search-results {
  display: flex;
  flex-direction: column;
}

.search-results:empty::after {
  content: "Type keywords to search";
  display: block;
  padding: 28px 20px;
  text-align: center;
  color: var(--post-meta);
  font-size: 14px;
}

.search-result {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition);
}

.search-result:hover {
  background: var(--surface-2);
}

.search-result-title {
  font-weight: 600;
  color: var(--font-color);
  font-size: 15px;
}

.search-result-excerpt {
  margin-top: 4px;
  font-size: 13px;
  color: var(--midgrey);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ---------- Lightbox ---------- */

.kaldorei-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.kaldorei-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 18, 0.88);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.kaldorei-lightbox-img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.kaldorei-lightbox.is-open .kaldorei-lightbox-backdrop,
.kaldorei-lightbox.is-open .kaldorei-lightbox-img {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 40px;
  padding: 40px 0 32px;
  border-top: 1px solid var(--border-color);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--font-color);
}

.footer-desc {
  margin: 0;
  font-size: 14px;
  color: var(--midgrey);
  max-width: 480px;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.footer-nav a {
  color: var(--midgrey);
}

.footer-nav a:hover {
  color: var(--primary-color);
}

.footer-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--post-meta);
}

.footer-meta-row a {
  color: var(--post-meta);
}

.footer-meta-row a:hover {
  color: var(--primary-color);
}

/* ---------- Back to top ---------- */

.back-top {
  position: fixed;
  right: 24px;
  bottom: 32px;
  z-index: 1500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition), background-color var(--transition);
}

.back-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-top:hover {
  background: var(--primary-light-hover);
}

/* ---------- Scroll reveal animation ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .post-card-image,
  .post-card-row-image,
  .post-card,
  .post-nav a,
  .social-link,
  .tag-item {
    transition: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .content {
    max-width: 100%;
  }

  .sidebar {
    position: static;
    flex-basis: 100%;
  }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    margin-left: 0;
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    backdrop-filter: blur(16px) saturate(1.6);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .main-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .main-nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 24px 20px;
  }

  .main-nav-menu > li > a {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
  }

  .main-nav-menu > li > a::after {
    display: none;
  }

  .main-nav-menu > li.nav-current > a {
    background: rgba(0, 154, 97, 0.09);
  }

  .post-card-row {
    flex-direction: column;
  }

  .post-card-row .post-card-row-image-link {
    flex-basis: auto;
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .post-card-body {
    padding: 22px;
  }

  .post-title {
    font-size: 26px;
  }

  .author-page-header {
    flex-direction: column;
    text-align: center;
  }

  .author-page-meta {
    justify-content: center;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav-prev,
  .post-nav-next {
    max-width: 100%;
  }

  .post-nav-next {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }

  .post-card-body {
    padding: 18px;
  }

  .post-card-row-body {
    padding: 18px;
  }

  .post-title {
    font-size: 23px;
  }

  .post-card-title {
    font-size: 19px;
  }
}

/* ---------- Ghost 5 required / memberships ---------- */

.site-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-subscribe-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

.gh-subscribe-btn:hover {
  background: var(--primary-light-hover);
  color: #fff;
  transform: translateY(-1px);
}
