/**
 * Single post styles
 *
 * @package Renowners_Artimed
 */

/* ───────────────────────────────────────────
   Back link
   ─────────────────────────────────────────── */

.single-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-brand);
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
}

.single-back:hover {
  color: var(--color-brand-light);
}

.single-back svg {
  flex-shrink: 0;
}

/* ───────────────────────────────────────────
   Hero Banner
   ─────────────────────────────────────────── */

.single-hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
  background: linear-gradient(to bottom, var(--color-hero-bg) 0%, var(--color-white) 100%);
}

.single-hero__card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
}

.single-hero__card--empty {
  background: linear-gradient(135deg, var(--color-brand-dark) 0%, var(--color-brand) 100%);
}

.single-hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.single-hero__overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: clamp(32px, 5vw, 56px);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.single-hero__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.single-hero__date {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.8);
}

.single-hero__badge {
  margin: 0;
}

.single-hero__title {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-white);
  margin: 0;
  max-width: 720px;
}

.single-hero__btn {
  margin-top: var(--space-xs);
  align-self: flex-start;
}

.single-hero__excerpt {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 640px;
}

/* ───────────────────────────────────────────
   Content + Sidebar Layout
   ─────────────────────────────────────────── */

.single-body {
  padding: var(--space-2xl) 0 var(--space-section);
}

.single-layout {
  display: flex;
  gap: var(--space-3xl);
  align-items: flex-start;
}

.single-content {
  flex: 1;
  min-width: 0;
}

.single-sidebar {
  flex: 0 0 320px;
  width: 320px;
}

.single-sidebar__sticky {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* ───────────────────────────────────────────
   Content Typography (Gutenberg output)
   ─────────────────────────────────────────── */

.single-content > * + * {
  margin-top: var(--space-lg);
}

.single-content h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-black);
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-md);
  scroll-margin-top: 120px;
}

.single-content h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-black);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  scroll-margin-top: 120px;
}

.single-content h4,
.single-content h5,
.single-content h6 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-black);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.single-content p {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-black);
}

.single-content ul,
.single-content ol {
  padding-left: var(--space-xl);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-black);
}

.single-content ul li,
.single-content ol li {
  margin-bottom: var(--space-sm);
}

.single-content blockquote {
  border-left: 3px solid var(--color-brand);
  padding: var(--space-lg) var(--space-xl);
  margin: var(--space-2xl) 0;
  background: var(--color-hero-bg);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--color-black);
}

.single-content blockquote p {
  margin: 0;
}

.single-content img,
.single-content figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

.single-content figure {
  margin: var(--space-2xl) 0;
}

.single-content figcaption {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  text-align: center;
}

.single-content a {
  color: var(--color-brand);
  font-weight: 500;
  transition: color var(--transition-fast);
  text-decoration: underline;
  text-decoration-color: var(--color-action);
  text-underline-offset: 3px;
}

.single-content a:hover {
  color: var(--color-action);
}

.single-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

/* ───────────────────────────────────────────
   Sidebar Boxes
   ─────────────────────────────────────────── */

.sidebar-box {
  padding: var(--space-lg);
  background: var(--color-bg-light);
  border-radius: var(--radius-xl);
}

.sidebar-box__title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-black);
  margin: 0 0 var(--space-md);
}

/* ───────────────────────────────────────────
   Share Links
   ─────────────────────────────────────────── */

.share-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.share-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  font-family: var(--font-primary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-black);
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.share-link:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.share-link__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--color-hero-bg);
  flex-shrink: 0;
}

.share-link__icon svg {
  color: var(--color-brand);
}

/* ───────────────────────────────────────────
   Table of Contents
   ─────────────────────────────────────────── */

.toc {
  position: relative;
  padding-left: 10px;
}

.toc__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
  border-radius: 1px;
}

.toc__progress-bar {
  width: 100%;
  height: 0%;
  background: var(--color-brand);
  border-radius: 1px;
  transition: height 0.2s ease;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc__item {
  margin: 0;
  padding: 0;
}

.toc__link {
  display: block;
  padding: 5px 6px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-black);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  line-height: var(--line-height-normal);
}

.toc__link:hover {
  color: var(--color-brand);
}

.toc__item--h3 .toc__link {
  padding-left: 16px;
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.toc__item.is-active .toc__link {
  color: var(--color-brand);
  font-weight: 600;
  background: var(--color-hero-bg);
}

/* ───────────────────────────────────────────
   Popular Posts
   ─────────────────────────────────────────── */

.popular-box {
  padding: 0;
  background: none;
}

.popular-posts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.popular-post {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-white);
  transition: box-shadow var(--transition-base);
}

.popular-post:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.popular-post__image-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.popular-post__image-wrap--empty {
  background: linear-gradient(135deg, var(--color-hero-bg) 0%, #cce5e3 100%);
}

.popular-post__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(.4, 0, .2, 1);
}

.popular-post:hover .popular-post__img {
  transform: scale(1.04);
}

.popular-post__cat {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-white);
  background: var(--color-brand);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.popular-post__read {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-brand);
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.popular-post__read svg {
  transition: transform 0.25s ease;
}

.popular-post:hover .popular-post__read {
  opacity: 1;
  transform: translateY(0);
}

.popular-post:hover .popular-post__read svg {
  transform: translateX(2px);
}

.popular-post__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popular-post__date {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.popular-post__title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-black);
  line-height: var(--line-height-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ───────────────────────────────────────────
   Popular Grupa (sidebar in single-grupa)
   ─────────────────────────────────────────── */

.popular-grupa-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.popular-grupa-item {
  border-bottom: 1px solid var(--color-border);
}

.popular-grupa-item:last-child {
  border-bottom: none;
}

.popular-grupa-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  text-decoration: none;
  color: var(--color-black);
  transition: color var(--transition-fast);
}

.popular-grupa-link:hover {
  color: var(--color-brand);
}

.popular-grupa-link:hover .popular-grupa-arrow {
  color: var(--color-brand);
  transform: translateX(3px);
}

.popular-grupa-thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.popular-grupa-thumb--empty {
  display: block;
  background: linear-gradient(135deg, var(--color-brand-dark), var(--color-brand));
}

.popular-grupa-name {
  flex: 1;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: var(--line-height-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-grupa-arrow {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

/* ───────────────────────────────────────────
   Post Navigation (prev / next)
   ─────────────────────────────────────────── */

.post-nav-section {
  padding-bottom: var(--space-section);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.post-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.post-nav__link:hover {
  border-color: var(--color-brand);
  box-shadow: 0 2px 12px rgba(0, 91, 83, 0.08);
}

.post-nav__link--empty {
  border: none;
}

.post-nav__link--next {
  text-align: right;
  justify-content: flex-end;
}

.post-nav__arrow {
  flex-shrink: 0;
  color: var(--color-brand);
}

.post-nav__thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-hero-bg);
}

.post-nav__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-nav__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.post-nav__label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-nav__title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-black);
  line-height: var(--line-height-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ───────────────────────────────────────────
   Responsive
   ─────────────────────────────────────────── */

@media (max-width: 991px) {
  .single-layout {
    flex-direction: column;
  }

  .single-sidebar {
    flex: none;
    width: 100%;
  }

  .single-sidebar__sticky {
    position: static;
  }

  .single-hero__title {
    font-size: var(--font-size-3xl);
  }

  .single-hero__card {
    min-height: 340px;
  }
}

@media (max-width: 640px) {
  .single-hero__card {
    min-height: 280px;
  }

  .single-hero__title {
    font-size: var(--font-size-2xl);
  }

  .single-hero__overlay {
    padding: var(--space-xl);
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav__link--empty {
    display: none;
  }

  .sidebar-box {
    padding: var(--space-md);
  }

  .post-nav__thumb {
    width: 48px;
    height: 48px;
  }
}
