/**
 * Theme5 — Nexus-style blog UI (ported from React app remix-of-lifestyle-blog-main)
 * Design tokens: HSL variables, DM Sans, container-blog, blog cards, sections.
 */

/* ---------- Design tokens (from React index.css) ---------- */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 8%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 8%;
  --primary: 0 0% 8%;
  --primary-foreground: 0 0% 98%;
  --secondary: 0 0% 96%;
  --secondary-foreground: 0 0% 20%;
  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 45%;
  --accent: 0 0% 94%;
  --border: 0 0% 90%;
  --ring: 0 0% 8%;
  --content-width: 1200px;
  --header-height: 80px;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --section-padding: 4rem;
  --card-padding: 1.5rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Resolved colors for use in CSS */
:root {
  --t5-bg: hsl(var(--background));
  --t5-fg: hsl(var(--foreground));
  --t5-card: hsl(var(--card));
  --t5-card-fg: hsl(var(--card-foreground));
  --t5-primary: hsl(var(--primary));
  --t5-primary-fg: hsl(var(--primary-foreground));
  --t5-muted: hsl(var(--muted));
  --t5-muted-fg: hsl(var(--muted-foreground));
  --t5-border: hsl(var(--border));
}

/* ---------- Base ---------- */
.theme5-body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--t5-bg);
  color: var(--t5-fg);
  min-height: 100vh;
  line-height: 1.6;
}

.theme5-body * {
  box-sizing: border-box;
}

/* ---------- Container ---------- */
.theme5-container-blog {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ---------- Header ---------- */
.theme5-header {
  background: var(--t5-bg);
  border-bottom: 1px solid var(--t5-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.theme5-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 5rem;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .theme5-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
  }
  .theme5-header-inner .theme5-logo { justify-self: start; }
  .theme5-header-inner .theme5-nav { justify-self: center; }
  .theme5-header-inner .theme5-header-actions { justify-self: end; }
}

.theme5-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--t5-fg);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.theme5-logo:hover {
  color: var(--t5-fg);
}

.theme5-nav {
  display: none;
}

@media (min-width: 1024px) {
  .theme5-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
  }
}

.theme5-nav-link {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--t5-fg);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.theme5-nav-link:hover {
  color: var(--t5-muted-fg);
}

.theme5-nav-link--active {
  border-bottom: 2px solid currentColor;
}

/* Categories dropdown in nav */
.theme5-nav-dropdown-wrap {
  position: relative;
}

.theme5-nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--t5-fg);
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.theme5-nav-dropdown-btn:hover {
  color: var(--t5-muted-fg);
}

.theme5-nav-dropdown-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.theme5-nav-dropdown-wrap[aria-expanded="true"] .theme5-nav-dropdown-arrow,
.theme5-nav-dropdown-menu.theme5-nav-dropdown-open + .theme5-nav-dropdown-arrow {
  transform: rotate(180deg);
}

.theme5-nav-dropdown-btn[aria-expanded="true"] + .theme5-nav-dropdown-menu .theme5-nav-dropdown-arrow {
  transform: rotate(180deg);
}

.theme5-nav-dropdown-wrap:has(.theme5-nav-dropdown-open) .theme5-nav-dropdown-arrow {
  transform: rotate(180deg);
}

.theme5-nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0.25rem 0 0 0;
  padding: 0.5rem 0;
  min-width: 220px;
  max-height: 70vh;
  overflow-y: auto;
  list-style: none;
  background: var(--t5-card);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  display: none;
}

.theme5-nav-dropdown-menu.theme5-nav-dropdown-open {
  display: block;
}

.theme5-nav-dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--t5-fg);
  text-decoration: none;
  white-space: nowrap;
}

.theme5-nav-dropdown-item:hover {
  background: var(--t5-muted);
  color: var(--t5-fg);
}

.theme5-nav-dropdown-item--active {
  background: var(--t5-muted);
  color: var(--t5-primary);
}

.theme5-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile: hide Account/Logout/Login/Register/Post Ad from bar (use mobile nav instead), comfortable tap targets */
@media (max-width: 1023px) {
  .theme5-header-inner {
    gap: 0.5rem;
    min-height: 3.5rem;
  }
  .theme5-header-actions {
    gap: 0.5rem;
    flex-shrink: 0;
  }
  .theme5-header-actions .theme5-btn-header {
    display: none;
  }
  .theme5-header-icon {
    min-width: 2.75rem;
    min-height: 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
  }
  .theme5-mobile-menu-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
  }
  .theme5-logo {
    font-size: 1.1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 480px) and (max-width: 1023px) {
  .theme5-header-icon {
    min-width: 2.5rem;
    min-height: 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }
  .theme5-mobile-menu-btn {
    min-width: 2.5rem;
    min-height: 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }
}

.theme5-header-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme5-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--t5-fg);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  font-size: 0.75rem;
}

.theme5-header-icon:hover {
  background: var(--t5-muted);
  color: var(--t5-fg);
}

.theme5-theme-toggle {
  cursor: pointer;
  border: 1px solid var(--t5-border);
  padding: 0;
}

.theme5-theme-icon-dark {
  display: none;
}

.theme5-dark .theme5-theme-icon-light {
  display: none;
}

.theme5-dark .theme5-theme-icon-dark {
  display: inline-block;
}

.theme5-btn-header {
  font-size: 0.75rem;
  padding: 0;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme5-btn-primary-header {
  background: var(--t5-primary) !important;
  color: var(--t5-primary-fg) !important;
  border-color: var(--t5-primary) !important;
}

@media (min-width: 1024px) {
  .theme5-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
}

.theme5-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--t5-fg);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.theme5-btn-icon:hover {
  background: var(--t5-muted);
  color: var(--t5-fg);
}

.theme5-mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--t5-fg);
  cursor: pointer;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .theme5-mobile-menu-btn {
    display: none;
  }
}

/* When mobile menu is open, prevent page scroll */
@media (max-width: 1023px) {
  body.theme5-mobile-menu-open {
    overflow: hidden;
    touch-action: none;
  }
}

.theme5-mobile-nav {
  border-top: 1px solid var(--t5-border);
  padding: 1rem 0;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .theme5-mobile-nav {
    display: none;
  }
}

.theme5-mobile-nav .theme5-nav-link {
  display: block;
  padding: 0.5rem 0;
}

.theme5-mobile-nav-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--t5-muted-fg);
  padding: 0.75rem 0 0.35rem 0;
  text-transform: uppercase;
}

.theme5-mobile-nav-sub {
  padding-left: 1rem;
}

.theme5-mobile-nav.collapse {
  display: none;
}

@media (min-width: 1024px) {
  .theme5-mobile-nav.collapse {
    display: none;
  }
}

.theme5-nav-link--active {
  color: var(--t5-primary);
}

/* ---------- Dark mode ---------- */
.theme5-dark,
html.theme5-dark,
html[data-theme="dark"] {
  --background: 222 47% 11%;
  --foreground: 210 40% 98%;
  --card: 222 47% 14%;
  --card-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222 47% 11%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --border: 217 33% 22%;
  --accent: 217 33% 17%;
}

.theme5-dark .theme5-btn-primary-header {
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
  border-color: hsl(var(--primary)) !important;
}

.theme5-dark .theme5-featured .theme5-btn-outline,
.theme5-dark .theme5-editors-card .theme5-btn-outline {
  color: hsl(24 95% 53%);
  border-color: hsl(24 95% 53%);
}

.theme5-dark .theme5-featured .theme5-btn-outline:hover {
  background: hsl(24 95% 53%);
  color: hsl(0 0% 98%);
}

/* Dark mode: newsletter box stays black; keep input readable */
.theme5-dark .theme5-sidebar-newsletter .theme5-newsletter-input,
html[data-theme="dark"] .theme5-sidebar-newsletter .theme5-newsletter-input {
  background: #fff;
  color: #1a1a1a;
  border-color: #444;
}

/* ---------- Skip link ---------- */
.theme5-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0.5rem 1rem;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
  border-radius: var(--radius-md);
  z-index: 100;
  text-decoration: none;
  font-size: var(--text-sm);
}

.theme5-skip-link:focus {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ---------- Main ---------- */
.theme5-main {
  flex: 1;
}

/* ---------- Featured Article (Hero) ---------- */
.theme5-featured {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.theme5-featured-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 1024px) {
  .theme5-featured-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.theme5-featured-image-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.theme5-featured-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s;
}

.theme5-featured-image-wrap:hover img {
  transform: scale(1.05);
}

.theme5-featured-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.theme5-featured-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--t5-fg);
  margin: 0;
}

.theme5-featured-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--text-sm);
}

.theme5-blog-meta {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--t5-muted-fg);
}

.theme5-meta-upper {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme5-featured-excerpt {
  font-size: var(--text-lg);
  color: var(--t5-muted-fg);
  line-height: 1.6;
  margin: 0;
}

.theme5-home-empty {
  text-align: center;
  padding: 2rem 1rem;
}

.theme5-home-empty .theme5-footer-text {
  margin: 0;
}

.theme5-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--t5-fg);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  align-self: flex-start;
}

.theme5-btn-outline:hover {
  background: var(--t5-muted);
  color: var(--t5-fg);
}

/* ---------- Section title ---------- */
.theme5-section-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--t5-fg);
  margin: 0 0 2rem 0;
}

/* ---------- Editor's Pick (carousel) ---------- */
.theme5-editors-pick {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.theme5-editors-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.theme5-editors-pick-head .theme5-section-title {
  margin-bottom: 0;
}

.theme5-carousel-controls {
  display: flex;
  gap: 0.5rem;
}

.theme5-carousel-controls .theme5-btn-icon {
  width: 2rem;
  height: 2rem;
}

.theme5-editors-scroll {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.theme5-editors-scroll::-webkit-scrollbar {
  display: none;
}

.theme5-editors-card {
  flex: 0 0 320px;
  background: var(--t5-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.theme5-editors-card:hover {
  box-shadow: var(--shadow-md);
}

.theme5-editors-card-image {
  aspect-ratio: 4/3;
  overflow: hidden;
}

.theme5-editors-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.theme5-editors-card:hover .theme5-editors-card-image img {
  transform: scale(1.05);
}

.theme5-editors-card-body {
  padding: 1.5rem;
}

.theme5-editors-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-xs);
}

.theme5-editors-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--t5-fg);
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.theme5-editors-card-excerpt {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

/* ---------- Trending ---------- */
.theme5-trending {
  padding-top: 4rem;
  padding-bottom: 4rem;
  background: hsl(0 0% 96% / 0.5);
}

.theme5-trending-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .theme5-trending-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .theme5-trending-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Blog card (shared) ---------- */
.theme5-blog-card {
  background: var(--t5-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
}

.theme5-blog-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--t5-fg);
}

.theme5-blog-card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.theme5-blog-card.theme5-blog-card--small .theme5-blog-card-image {
  aspect-ratio: 3/2;
}

.theme5-blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.theme5-blog-card:hover .theme5-blog-card-image img {
  transform: scale(1.05);
}

.theme5-blog-card-body {
  padding: 1.5rem;
}

.theme5-blog-card.theme5-blog-card--small .theme5-blog-card-body {
  padding: 1rem;
}

.theme5-blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: var(--text-xs);
}

.theme5-blog-card-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  color: var(--t5-muted-fg);
}
.theme5-blog-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.theme5-blog-card-stats i {
  font-size: 0.7rem;
  opacity: 0.9;
}

.theme5-blog-card-title {
  font-weight: 700;
  color: var(--t5-fg);
  line-height: 1.3;
  margin: 0;
}

.theme5-blog-card .theme5-blog-card-title {
  font-size: var(--text-lg);
}

.theme5-blog-card.theme5-blog-card--small .theme5-blog-card-title {
  font-size: var(--text-base);
}

.theme5-blog-card-excerpt {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  line-height: 1.5;
  margin-top: 0.5rem;
}

.theme5-card-read-more {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--t5-fg);
  margin-top: 0.75rem;
}

.theme5-dark .theme5-card-read-more {
  color: hsl(24 95% 53%);
}

/* ---------- Masonry (Featured Stories) ---------- */
.theme5-masonry {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.theme5-masonry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  grid-auto-rows: 180px;
  grid-auto-flow: row dense;
}

@media (min-width: 768px) {
  .theme5-masonry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .theme5-masonry-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .theme5-masonry-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.theme5-masonry-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: var(--t5-card);
  border: 1px solid var(--t5-border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.theme5-masonry-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.theme5-masonry-item--tall {
  grid-row: span 3;
}

.theme5-masonry-item--medium {
  grid-row: span 2;
}

.theme5-masonry-item--short {
  grid-row: span 1;
}

.theme5-masonry-item-inner {
  position: absolute;
  inset: 0;
}

.theme5-masonry-item-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s;
}

.theme5-masonry-item:hover .theme5-masonry-item-inner img {
  transform: scale(1.05);
}

.theme5-masonry-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
}

.theme5-masonry-item-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  color: #fff;
}

.theme5-masonry-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: var(--text-xs);
}

.theme5-masonry-item-cat {
  background: rgba(0,0,0,0.5);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
}

.theme5-masonry-item-title {
  font-size: var(--text-sm);
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 768px) {
  .theme5-masonry-item-title {
    font-size: var(--text-base);
  }
}

/* ---------- All Posts section ---------- */
.theme5-all-posts {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.theme5-all-posts-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .theme5-all-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .theme5-all-posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Search page ---------- */
.theme5-search-title {
  text-align: center;
  margin-bottom: 0.5rem;
}

.theme5-search-desc {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--t5-muted-fg);
}

.theme5-search-form {
  display: flex;
  align-items: center;
  max-width: 32rem;
  margin: 0 auto 2rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--t5-bg);
}

.theme5-search-icon {
  padding: 0 1rem;
  color: var(--t5-muted-fg);
  font-size: var(--text-sm);
}

.theme5-search-input {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  font-size: var(--text-base);
  background: transparent;
  color: var(--t5-fg);
}

.theme5-search-input::placeholder {
  color: var(--t5-muted-fg);
}

.theme5-search-form .theme5-btn-outline {
  border-radius: 0;
  border-left: 1px solid var(--t5-border);
  margin: 0;
}

.theme5-search-empty {
  text-align: center;
  padding: 2rem 1rem;
}

.theme5-search-prompt {
  font-weight: 700;
  font-size: var(--text-lg);
  margin: 0 0 0.5rem 0;
  color: var(--t5-fg);
}

.theme5-search-category-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.theme5-search-category-btns .theme5-btn-outline {
  text-decoration: none;
}

/* ---------- Listing pages (category, state, city) ---------- */
.theme5-listing-hero {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-listing-hero--centered {
  text-align: center;
}

.theme5-listing-hero-title {
  margin: 0 0 0.5rem 0;
}

.theme5-listing-hero-desc {
  margin: 0;
  font-size: var(--text-base);
  color: var(--t5-muted-fg);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.theme5-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.theme5-filter-search {
  flex: 1;
  min-width: 200px;
}

.theme5-filter-input,
.theme5-filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-bg);
  color: var(--t5-fg);
}

.theme5-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.theme5-filter-select {
  width: auto;
  min-width: 160px;
}

.theme5-search-inline {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 28rem;
}

.theme5-search-inline .theme5-filter-input {
  flex: 1;
}

.theme5-view-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.theme5-view-toggle {
  display: inline-flex;
  gap: 0;
}

.theme5-view-toggle--inline {
  margin-left: auto;
  margin-right: 0;
}

.theme5-view-btn {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  border: 1px solid var(--t5-border);
  background: var(--t5-bg);
  color: var(--t5-fg);
  text-decoration: none;
  border-radius: 0;
}

.theme5-view-btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.theme5-view-btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 0;
}

.theme5-view-btn.theme5-view-active {
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
  border-color: var(--t5-primary);
}

.theme5-view-btn:hover:not(.theme5-view-active) {
  background: var(--t5-muted);
}

.theme5-empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.theme5-empty-state .theme5-btn-outline {
  margin-top: 1rem;
}

.theme5-listing-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme5-listing-list-card {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-card);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s;
}

.theme5-listing-list-card:hover {
  box-shadow: var(--shadow-md);
}

.theme5-listing-list-image {
  flex: 0 0 180px;
  width: 180px;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.theme5-listing-list-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-listing-list-body {
  flex: 1;
  min-width: 0;
}

.theme5-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.theme5-page-link {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-bg);
  color: var(--t5-fg);
  text-decoration: none;
}

.theme5-page-link:hover {
  background: var(--t5-muted);
}

.theme5-page-link.theme5-page-active {
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
  border-color: var(--t5-primary);
}

.theme5-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.theme5-cat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-card);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.theme5-cat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--t5-fg);
}

.theme5-cat-icon {
  font-size: 1.5rem;
  color: var(--t5-muted-fg);
}

.theme5-cat-name {
  font-weight: 600;
  color: var(--t5-fg);
}

.theme5-cat-count {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-location-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.theme5-location-pill {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  border: 1px solid var(--t5-border);
  border-radius: 9999px;
  background: var(--t5-bg);
  color: var(--t5-fg);
  text-decoration: none;
  transition: background 0.2s;
}

.theme5-location-pill:hover {
  background: var(--t5-muted);
}

/* ---------- Post-ad / Form card ---------- */
.theme5-form-card {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 0;
}

.theme5-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.theme5-alert-error {
  background: hsl(0 84% 96%);
  border: 1px solid hsl(0 72% 80%);
  color: hsl(0 72% 30%);
}

.theme5-alert-list {
  margin: 0;
  padding-left: 1.25rem;
}

.theme5-form-group {
  margin-bottom: 1.5rem;
}

.theme5-form-group label,
.theme5-form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--t5-fg);
  margin-bottom: 0.375rem;
}

.theme5-form-label-small {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-input,
.theme5-select,
.theme5-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-base);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-bg);
  color: var(--t5-fg);
  font-family: inherit;
}

.theme5-textarea {
  min-height: 120px;
  resize: vertical;
}

.theme5-other-input {
  max-width: 20rem;
}

/* Post-ad: description sections (header + content blocks, TOC) */
.theme5-description-sections-wrap .theme5-form-label {
  margin-bottom: 0.25rem;
}
.theme5-description-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.theme5-description-section-block {
  padding: 1.25rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-muted);
}
.theme5-section-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.theme5-section-block-num {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--t5-fg);
}
.theme5-section-use-header-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--t5-fg);
  margin-bottom: 0.75rem;
  cursor: pointer;
  font-weight: normal;
}
.theme5-section-use-header-wrap input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}
.theme5-btn-remove-section {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-bg);
  color: var(--t5-muted-fg);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme5-btn-remove-section:hover {
  background: var(--t5-border);
  color: var(--t5-fg);
}
.theme5-btn-add-section {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Ad detail: section content from structured description */
.theme5-description-section {
  margin-bottom: 1.5rem;
  scroll-margin-top: 6rem;
}
.theme5-description-section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--t5-fg);
}
.theme5-description-section-content {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--t5-fg);
}

.theme5-upload-zone {
  position: relative;
  border: 2px dashed var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-muted);
  padding: 2rem;
  text-align: center;
}
/* File input overlays zone so it has real dimensions and is submitted with form; opacity 0 so placeholder shows */
.theme5-file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
  margin: 0;
  padding: 0;
  font-size: 0;
}
.theme5-upload-zone #theme5-upload-placeholder {
  position: relative;
  z-index: 0;
}

.theme5-upload-icon {
  font-size: 2rem;
  color: var(--t5-muted-fg);
}

.theme5-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--t5-border);
}

.theme5-btn-primary {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  cursor: pointer;
}

.theme5-btn-primary:hover {
  opacity: 0.9;
}

.theme5-auth-card {
  max-width: 28rem;
  margin: 0 auto;
}

.theme5-alert-success {
  background: hsl(142 76% 95%);
  border: 1px solid hsl(142 72% 80%);
  color: hsl(142 72% 28%);
}

.theme5-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme5-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  cursor: pointer;
}

.theme5-checkbox-label input {
  width: 1rem;
  height: 1rem;
}

.theme5-link {
  color: var(--t5-primary);
  text-decoration: none;
  font-size: var(--text-sm);
}

.theme5-link:hover {
  text-decoration: underline;
}

.theme5-field-error {
  font-size: var(--text-xs);
  color: hsl(0 72% 45%);
  margin: 0.25rem 0 0 0;
}

/* ---------- Account dashboard ---------- */
.theme5-dashboard-wrap {
  padding: 2rem 0 4rem;
}

.theme5-dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 768px) {
  .theme5-dashboard-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.theme5-dashboard-sidebar {
  flex: 0 0 260px;
}

@media (min-width: 768px) {
  .theme5-dashboard-sidebar {
    position: sticky;
    top: calc(var(--header-height, 80px) + 1rem);
  }
}

.theme5-dashboard-sidebar-card {
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-card);
  overflow: hidden;
}

.theme5-dashboard-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-dashboard-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.theme5-dashboard-user-name {
  font-weight: 600;
  font-size: var(--text-sm);
  margin: 0;
  color: var(--t5-fg);
}

.theme5-dashboard-user-email {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme5-dashboard-nav {
  display: flex;
  flex-direction: column;
}

.theme5-dashboard-nav-link {
  padding: 0.75rem 1.25rem;
  font-size: var(--text-sm);
  color: var(--t5-fg);
  text-decoration: none;
  border-bottom: 1px solid var(--t5-border);
  transition: background 0.2s;
}

.theme5-dashboard-nav-link:last-of-type {
  border-bottom: none;
}

.theme5-dashboard-nav-link:hover {
  background: var(--t5-muted);
}

.theme5-dashboard-nav-link.theme5-dashboard-nav-active {
  background: var(--t5-muted);
  font-weight: 600;
  border-left: 3px solid var(--t5-primary);
}

.theme5-dashboard-cta {
  padding: 1rem 1.25rem;
}

.theme5-dashboard-main {
  flex: 1;
  min-width: 0;
}

.theme5-dashboard-card {
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-card);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.theme5-dashboard-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--t5-fg);
}

.theme5-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .theme5-dashboard-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.theme5-dashboard-stat {
  padding: 1rem;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  background: var(--t5-bg);
}

.theme5-dashboard-stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--t5-fg);
}

.theme5-dashboard-stat-label {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
  margin: 0;
}

.theme5-dashboard-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-dashboard-recent-item:last-child {
  border-bottom: none;
}

.theme5-dashboard-badge {
  font-size: var(--text-xs);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
}

.theme5-dashboard-badge-active { background: hsl(142 76% 92%); color: hsl(142 72% 28%); }
.theme5-dashboard-badge-pending { background: hsl(221 83% 92%); color: hsl(221 72% 35%); }
.theme5-dashboard-badge-rejected { background: hsl(0 84% 92%); color: hsl(0 72% 35%); }

.theme5-myad-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-myad-item:last-child {
  border-bottom: none;
}

.theme5-myad-image {
  width: 120px;
  height: 84px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--t5-muted);
}

.theme5-myad-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-fav-item:last-child {
  border-bottom: none;
}

/* ---------- Footer ---------- */
.theme5-footer {
  background: var(--t5-muted);
  border-top: 1px solid var(--t5-border);
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.theme5-footer-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .theme5-footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.theme5-footer-about-col .theme5-footer-text {
  margin-bottom: 1rem;
}

.theme5-footer-subheading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--t5-fg);
  margin: 0 0 0.75rem 0;
  letter-spacing: 0.05em;
}

.theme5-footer-social {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theme5-footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--t5-border);
  color: var(--t5-fg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.theme5-footer-social a:hover {
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
}

.theme5-footer-company-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}

.theme5-footer-recent-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme5-footer-recent-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

.theme5-footer-recent-item:hover {
  color: var(--t5-primary);
}

.theme5-footer-recent-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--t5-border);
}

.theme5-footer-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-footer-recent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.theme5-footer-recent-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--t5-fg);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme5-footer-recent-item:hover .theme5-footer-recent-title {
  color: var(--t5-primary);
}

.theme5-footer-recent-date {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-footer-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--t5-fg);
  margin: 0 0 1rem 0;
}

.theme5-footer-text {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  margin: 0;
  line-height: 1.5;
}

.theme5-footer-heading {
  font-weight: 600;
  color: var(--t5-fg);
  margin: 0 0 1rem 0;
  font-size: var(--text-base);
}

.theme5-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.theme5-footer-links li {
  margin-bottom: 0.5rem;
}

.theme5-footer-links a {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  text-decoration: none;
  transition: color 0.2s;
}

.theme5-footer-links a:hover {
  color: var(--t5-fg);
}

.theme5-footer-connect {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.theme5-footer-connect a {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  text-decoration: none;
  transition: color 0.2s;
}

.theme5-footer-connect a:hover {
  color: var(--t5-fg);
}

.theme5-footer-bottom {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--t5-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
}

@media (max-width: 575px) {
  .theme5-footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Ad detail page ---------- */
.theme5-ad-detail {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.theme5-ad-detail-breadcrumb {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  margin-bottom: 1.5rem;
}

.theme5-ad-detail-breadcrumb a {
  color: var(--t5-muted-fg);
  text-decoration: none;
}

.theme5-ad-detail-breadcrumb a:hover {
  color: var(--t5-fg);
}

.theme5-ad-detail-breadcrumb span:not([aria-hidden]) {
  color: var(--t5-fg);
}

.theme5-ad-detail-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .theme5-ad-detail-grid {
    grid-template-columns: 1fr 320px;
  }
}

.theme5-ad-detail-hero {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.theme5-ad-detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-ad-detail-views-badge--on-image {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.theme5-ad-detail-views-badge--on-image i {
  font-size: 0.85em;
  opacity: 0.95;
}

.theme5-ad-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-ad-detail-meta-sep {
  margin: 0 0.35rem;
  color: var(--t5-muted-fg);
}

.theme5-ad-detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.theme5-ad-detail-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.2;
  color: var(--t5-fg);
}

.theme5-ad-detail-views-badge {
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--t5-muted-fg);
  white-space: nowrap;
}

.theme5-ad-detail-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
}

.theme5-ad-detail-author-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.theme5-ad-detail-author-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme5-ad-detail-author-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--t5-muted-fg);
  background: var(--t5-muted);
  border-radius: 50%;
  line-height: 1;
}

.theme5-ad-detail-author-name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--t5-fg);
}

.theme5-ad-detail-read-time {
  margin: 0;
  padding-left: 2.85rem;
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-ad-detail-author {
  font-weight: 500;
  color: var(--t5-fg);
}

.theme5-share-article-wrap {
  position: relative;
  margin-left: auto;
}

.theme5-btn-share-article {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  background: transparent;
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme5-btn-share-article:hover {
  color: var(--t5-fg);
  background: var(--t5-muted);
}

.theme5-share-article-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 10rem;
  padding: 0.5rem 0;
  background: var(--t5-bg);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.theme5-share-article-dropdown--hidden {
  display: none;
}

.theme5-share-article-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  color: var(--t5-fg);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.theme5-share-article-item:hover {
  background: var(--t5-muted);
}

.theme5-ad-detail-description {
  font-size: var(--text-base);
  color: var(--t5-muted-fg);
  line-height: 1.7;
  margin-bottom: 2rem;
}

/* Copy protection: no selection on post content */
.theme5-ad-detail-protected.theme5-no-copy,
.theme5-no-copy {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.theme5-description-canvas-wrap {
  max-width: 100%;
  overflow: hidden;
}

.theme5-description-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.theme5-ad-detail-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.theme5-ad-detail-dl dt {
  font-weight: 600;
  color: var(--t5-fg);
}

.theme5-ad-detail-dl dd {
  margin: 0;
  color: var(--t5-muted-fg);
}

.theme5-ad-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.theme5-ad-detail-contact {
  padding: 1.25rem;
  background: var(--t5-muted);
  border-radius: var(--radius-md);
}

.theme5-ad-detail-contact p {
  margin: 0 0 0.75rem 0;
}

.theme5-ad-detail-contact p:last-child {
  margin-bottom: 0;
}

.theme5-ad-detail-actions {
  margin-top: 1rem;
}

.theme5-ad-detail-share a {
  margin-right: 0.75rem;
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  text-decoration: none;
}

.theme5-ad-detail-share a:hover {
  color: var(--t5-fg);
}

.theme5-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.theme5-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm, 0.375rem);
  color: var(--t5-muted-fg);
  background: var(--t5-muted, #f1f5f9);
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  transition: color 0.15s, background 0.15s;
}

.theme5-share-btn:hover {
  color: var(--t5-fg);
  background: var(--t5-border, #e2e8f0);
}

.theme5-share-buttons a.theme5-share-btn:hover {
  color: var(--t5-fg);
  background: var(--t5-border, #e2e8f0);
}

.theme5-ad-detail-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.theme5-ad-detail-recent-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-ad-detail-recent-item:last-child {
  border-bottom: none;
}

.theme5-ad-detail-recent-item:hover {
  color: var(--t5-primary);
}

.theme5-ad-detail-recent-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--t5-muted);
}

.theme5-ad-detail-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-sidebar-toc {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: hsl(0, 0%, 98%);
  border: 1px solid var(--t5-border);
  border-radius: var(--radius-md);
  position: sticky;
  top: calc(var(--header-height, 80px) + 1rem);
  /* align-self: flex-start; */
}

.theme5-toc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.theme5-toc-icon {
  font-size: 1rem;
  color: var(--t5-muted-fg);
}

.theme5-toc-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--t5-fg);
}

.theme5-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
}

.theme5-toc-list li {
  margin: 0.35rem 0;
}

.theme5-toc-list a {
  color: var(--t5-muted-fg);
  text-decoration: none;
  transition: color 0.15s;
}

.theme5-toc-list a:hover {
  color: var(--t5-primary);
}

.theme5-sidebar-newsletter {
  background: #1a1a1a;
  color: #fff;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
}

.theme5-newsletter-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: #fff;
}

.theme5-newsletter-text {
  font-size: var(--text-sm);
  margin: 0 0 1rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.theme5-newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme5-newsletter-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: #fff;
  color: #1a1a1a;
}

.theme5-newsletter-input::placeholder {
  color: #666;
}

.theme5-newsletter-btn {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-transform: uppercase;
}

.theme5-newsletter-btn:hover {
  background: #fff;
  color: #1a1a1a;
}

.theme5-related-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--t5-border);
}

.theme5-related-section .theme5-section-title {
  margin-bottom: 1.5rem;
}

.theme5-related-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .theme5-related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.theme5-related-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--t5-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--t5-border);
  transition: box-shadow 0.2s;
}

.theme5-related-card:hover {
  box-shadow: var(--shadow-md);
}

.theme5-related-card-image {
  aspect-ratio: 4/3;
  overflow: hidden;
}

.theme5-related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme5-related-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.75rem 1rem 0;
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-related-card-meta-sep {
  color: var(--t5-muted-fg);
}

.theme5-related-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  padding: 0 1rem;
  line-height: 1.3;
}

.theme5-related-card-excerpt {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  margin: 0 0 1rem 0;
  padding: 0 1rem;
  line-height: 1.5;
}

.theme5-ad-detail-views {
  color: var(--t5-muted-fg);
  font-size: var(--text-sm);
}

.theme5-comments-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--t5-border);
}

.theme5-comments-section .theme5-section-title {
  margin-bottom: 1rem;
}

.theme5-comment {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--t5-border);
}

.theme5-comment:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.theme5-comment-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
}

.theme5-comment-body {
  min-width: 0;
}

.theme5-comment-header {
  margin-bottom: 0.35rem;
}

.theme5-comment-author {
  font-weight: 600;
  color: var(--t5-fg);
  margin-right: 0.5rem;
}

.theme5-comment-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--t5-primary);
  background: rgba(var(--t5-primary-rgb, 59, 130, 246), 0.12);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.theme5-comment-date {
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
}

.theme5-comment-text {
  font-size: var(--text-sm);
  color: var(--t5-fg);
  margin: 0;
  line-height: 1.5;
}

.theme5-comment-form {
  max-width: 32rem;
  margin-top: 1rem;
}

.theme5-comment-form .theme5-form-group {
  margin-bottom: 1rem;
}

.theme5-comment-form .theme5-btn-primary {
  margin-top: 0.5rem;
}

.theme5-comment-reply-btn {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--t5-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.theme5-comment-reply-btn:hover {
  color: var(--t5-fg);
}

.theme5-comment-reply-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--t5-border);
}

.theme5-comment-reply-form--hidden {
  display: none;
}

.theme5-comment-form--inline .theme5-form-group {
  margin-bottom: 0.75rem;
}

.theme5-comment-form--inline .theme5-btn-primary,
.theme5-comment-form--inline .theme5-btn-outline {
  margin-right: 0.5rem;
  margin-top: 0.25rem;
}

.theme5-comment-replies {
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--t5-border);
  margin-top: 0.5rem;
}

.theme5-comment--reply {
  margin-bottom: 1rem;
}

.theme5-comment--reply:last-child {
  margin-bottom: 0;
}

.theme5-post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.theme5-tag-chip {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: var(--text-xs);
  color: var(--t5-muted-fg);
  background: var(--t5-muted);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.theme5-tag-chip:hover {
  background: var(--t5-border);
  color: var(--t5-fg);
}

.theme5-sidebar-tags .theme5-footer-tags-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.theme5-sidebar-tags .theme5-footer-tags-list a {
  font-size: var(--text-sm);
  color: var(--t5-muted-fg);
  text-decoration: none;
}

.theme5-sidebar-tags .theme5-footer-tags-list a:hover {
  color: var(--t5-primary);
}

.theme5-filter-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.theme5-filter-tags-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--t5-fg);
  margin-right: 0.25rem;
}

.theme5-filter-tags .theme5-tag-chip--active {
  background: var(--t5-primary);
  color: var(--t5-primary-fg);
}

/* ---------- Maintenance page ---------- */
.theme5-maintenance {
  max-width: 32rem;
  margin: 0 auto;
  text-align: center;
  padding: 4rem 0;
}

.theme5-maintenance-icon {
  font-size: 4rem;
  color: var(--t5-fg);
  opacity: 0.3;
  margin-bottom: 1.5rem;
}

.theme5-maintenance-title {
  margin-top: 0;
  margin-bottom: 1rem;
}

.theme5-maintenance-text {
  margin-bottom: 2rem;
  color: var(--t5-muted-fg);
}

.theme5-maintenance-btn {
  display: inline-block;
}
