/* =============================================================================
   RDroid Blog — Premium reading experience (works with style.css + themes)
   ============================================================================= */

/* --- Blog list page --- */
.blog-list-page {
  --blog-max: min(1120px, 94vw);
}

.blog-list-hero {
  max-width: var(--blog-max);
  margin: 0 auto 2.5rem;
  padding: 2.5rem 1.5rem 2rem;
  padding-top: 80px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 20px 50px rgba(5, 80, 50, 0.08);
  animation: blogFadeUp 0.7s ease backwards;
}

/*
  Global `header { position: fixed; z-index: 99 }` (style.css) targets every <header>.
  blog/index.html also uses <header class="blog-list-hero"> for the hero — without an
  override it becomes a second fixed bar and stacks above the loaded nav. Reset flow here
  only; do not change style.css (other pages unaffected).
*/
.blog-list-page .blog-list-hero {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 0;
  display: block;
  justify-content: initial;
  align-items: initial;
  gap: normal;
}

/* Loaded site nav above blog glass cards / compositor layers (blog CSS only; not global) */
.blog-list-page #header-container>header,
.blog-post-page #header-container>header,
.blog-handbook-page #header-container>header {
  z-index: 1000;
}

.light-theme .blog-list-hero {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(0, 240, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 20px 50px rgba(0, 0, 0, 0.35);
}

.blog-list-hero .blog-list-lead {
  font-size: 1.125rem;
  line-height: 1.75;
  max-width: 42rem;
  margin: 1rem auto 1.5rem;
  color: var(--text);
}

.app-title a {
  color: #0369a1;
}

.blog-list-hero .blog-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

/* Featured + grid */
.blog-section-title {
  font-family: var(--font-display, "Poppins", sans-serif);
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  text-align: center;
}

.blog-section-sub {
  text-align: center;
  max-width: 36rem;
  margin: 0 auto 2rem;
  line-height: 1.65;
  color: var(--muted);
}

.blog-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.75rem;
  max-width: var(--blog-max);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 12px 36px rgba(5, 80, 50, 0.1);
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.45s ease;
  animation: blogFadeUp 0.65s ease backwards;
}

.light-theme .blog-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(0, 240, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.35);
}

.blog-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 24px 56px rgba(34, 197, 94, 0.2),
    0 0 0 1px rgba(34, 197, 94, 0.12);
}

.light-theme .blog-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 24px 56px rgba(0, 0, 0, 0.45),
    0 0 48px rgba(0, 240, 255, 0.15);
}

.blog-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(14, 165, 233, 0.12));
}

.blog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card__media img {
  transform: scale(1.06);
}

.blog-card__body {
  padding: 1.25rem 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.65rem;
}

.blog-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.blog-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  color: #14532d;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.light-theme .blog-tag {
  background: rgba(0, 240, 255, 0.12);
  color: #67e8f9;
  border-color: rgba(0, 240, 255, 0.28);
}

.blog-tag--muted {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
  border-color: rgba(148, 163, 184, 0.35);
}

.blog-card__title {
  font-family: var(--font-display, "Poppins", sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: var(--text);
}

.blog-card__excerpt {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.82rem;
  color: var(--muted);
}

.blog-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: #15803d;
  transition: gap 0.25s ease;
}

.light-theme .blog-card__cta {
  color: #22d3ee;
}

.blog-card:hover .blog-card__cta {
  gap: 0.55rem;
}

/* List rows (all posts) */
.blog-list-rows {
  max-width: var(--blog-max);
  margin: 0 auto;
  padding: 0 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.blog-row-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  align-items: stretch;
  padding: 1.25rem;
  border-radius: 22px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 32px rgba(5, 80, 50, 0.08);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.light-theme .blog-row-card {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(0, 240, 255, 0.15);
}

.blog-row-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(34, 197, 94, 0.15);
}

.light-theme .blog-row-card:hover {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.blog-row-card__thumb {
  border-radius: 14px;
  overflow: hidden;
  min-height: 100px;
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.2), rgba(14, 165, 233, 0.15));
}

.blog-row-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 100px;
}

.blog-row-card__content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blog-row-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

@media (max-width: 640px) {
  .blog-row-card {
    grid-template-columns: 1fr;
  }

  .blog-row-card__thumb {
    aspect-ratio: 16 / 9;
    max-height: 180px;
  }
}

/* --- Article reading (posts + articles) --- */
.blog-post-page .blog-reading {
  animation: blogFadeUp 0.75s ease 0.05s backwards;
}

.blog-post-page .wrap .hero .hero-right,
.blog-post-page .wrap>.hero:first-child {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.blog-post-page .wrap .hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.blog-post-page .wrap .hero .lead {
  font-size: 1.1rem;
  line-height: 1.75;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.blog-post-page .wrap .hero .meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.light-theme .blog-post-page .wrap .hero .meta {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(0, 240, 255, 0.15);
}

.blog-post-page .wrap .hero .cta {
  justify-content: center;
}

/* Narrow column for main sections */
.blog-post-page .section {
  max-width: 760px;
  margin-left: auto !important;
  margin-right: auto !important;
}

.blog-post-page .section .card {
  margin-left: 0;
  margin-right: 0;
}

/* Typography */
.blog-post-page .section p,
.blog-post-page .section .lead {
  font-size: 1.0625rem;
  line-height: 1.78;
  margin-bottom: 1.35rem;
}

.blog-post-page .section h2 {
  font-family: var(--font-display, "Poppins", sans-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.6rem);
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.blog-post-page .section h3 {
  font-size: 1.2rem;
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.blog-post-page .section h4 {
  font-size: 1.05rem;
  margin-top: 1.35rem;
}

/* Callouts */
.blog-callout {
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: linear-gradient(135deg, rgba(167, 243, 208, 0.35), rgba(255, 255, 255, 0.5));
  backdrop-filter: blur(8px);
  font-size: 0.98rem;
  line-height: 1.65;
}

.light-theme .blog-callout {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(15, 23, 42, 0.6));
  border-color: rgba(0, 240, 255, 0.22);
}

.blog-callout--tip::before {
  content: "Tip";
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #15803d;
  margin-bottom: 0.35rem;
}

.light-theme .blog-callout--tip::before {
  color: #22d3ee;
}

.blog-callout--important {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.5), rgba(255, 255, 255, 0.45));
}

.light-theme .blog-callout--important {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(15, 23, 42, 0.65));
}

.article-divider {
  height: 1px;
  margin: 2.5rem 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.45), transparent);
  border: none;
}

/* Buttons — blog premium */
.blog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: linear-gradient(165deg, #4ade80 0%, #16a34a 100%);
  color: #fff !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 6px 22px rgba(34, 197, 94, 0.35);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.light-theme .blog-btn {
  background: linear-gradient(165deg, #22d3ee 0%, #0ea5e9 50%, #0369a1 100%);
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 6px 22px rgba(0, 240, 255, 0.25);
}

.blog-btn:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 10px 32px rgba(34, 197, 94, 0.45);
}

.blog-btn--primary {
  font-weight: 800;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 8px 28px rgba(34, 197, 94, 0.42);
}

.light-theme .blog-btn--primary {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    0 8px 28px rgba(0, 240, 255, 0.35);
}

.blog-btn--sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
}

.blog-btn--ghost {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  color: #14532d !important;
  border: 1px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.12);
}

.light-theme .blog-btn--ghost {
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0 !important;
  border-color: rgba(0, 240, 255, 0.3);
}

.blog-btn--nav {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text) !important;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: none;
}

.light-theme .blog-btn--nav {
  background: rgba(30, 41, 59, 0.8);
  color: #f1f5f9 !important;
}

.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem auto 1rem;
  max-width: 760px;
}

.blog-post-page .part-navigation,
.blog-handbook-page .part-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem auto 1rem;
}

/* Share rail */
.blog-share-rail {
  position: fixed;
  right: max(1rem, calc((100vw - 760px) / 2 - 4rem));
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 32px rgba(5, 80, 50, 0.12);
}

.light-theme .blog-share-rail {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(0, 240, 255, 0.2);
}

.blog-share-rail a,
.blog-share-rail button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.light-theme .blog-share-rail a,
.light-theme .blog-share-rail button {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
}

.blog-share-rail a:hover,
.blog-share-rail button:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.35);
}

@media (max-width: 1100px) {
  .blog-share-rail {
    display: none;
  }
}

/* Related */
.blog-related-section {
  max-width: min(1120px, 94vw);
  margin: 3rem auto 2rem;
  padding: 0 1rem;
}

.blog-related-section h2 {
  font-family: var(--font-display, "Poppins", sans-serif);
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1.25rem;
}

.blog-related-card {
  display: block;
  padding: 1.25rem;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.light-theme .blog-related-card {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(0, 240, 255, 0.15);
}

.blog-related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.15);
}

.blog-related-card h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  line-height: 1.35;
}

.blog-related-card p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

/* Handbook pages — wider layout */
.blog-handbook-page .tools-container {
  max-width: min(1200px, 96vw);
  margin-left: auto;
  margin-right: auto;
}

.blog-handbook-page .sidebar {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
}

.light-theme .blog-handbook-page .sidebar {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: rgba(0, 240, 255, 0.15) !important;
}

.blog-handbook-page section.card {
  line-height: 1.75;
  font-size: 1.05rem;
}

.blog-handbook-page section.card p {
  margin-bottom: 1.25rem;
}

.blog-handbook-page section.card h2 {
  margin-top: 2rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

/* Links in articles */
.blog-post-page .section a:not(.blog-btn):not(.btn):not(.tool-btn):not(.nav-button),
.blog-handbook-page section.card a:not(.blog-btn) {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s ease;
}

.blog-post-page .section a:not(.blog-btn):not(.btn):not(.tool-btn):not(.nav-button):hover,
.blog-handbook-page section.card a:not(.blog-btn):hover {
  background-size: 100% 1px;
}

@keyframes blogFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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