/* Public Pages Styling */

.page-content {
  max-width: 80rem;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.page-article {
  background: #ffffff;
  border-radius: 0.8rem;
  padding: 4rem;
  box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.1);
}

/* Page Header */
.page-header {
  margin-bottom: 4rem;
}

.page-title {
  font-size: 4rem;
  font-weight: 300;
  line-height: 1.2;
  color: var(--brand-primary, #111827);
  margin: 0 0 1.6rem 0;
}

.page-meta {
  display: flex;
  gap: 1.6rem;
  align-items: center;
  font-size: 1.4rem;
  color: #6b7280;
}

.published-date {
  font-style: italic;
}

.category-badge {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 1.3rem;
}

/* Blocks Container */
.page-blocks {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* Text Block */
.block-text {
  font-size: 1.8rem;
  line-height: 1.75;
  color: #374151;
}

.block-text .trix-content {
  font-size: inherit;
  line-height: inherit;
}

.block-text h2 {
  font-size: 2.8rem;
  font-weight: 600;
  margin: 3rem 0 1.6rem 0;
  color: #111827;
}

.block-text h3 {
  font-size: 2.2rem;
  font-weight: 600;
  margin: 2.4rem 0 1.2rem 0;
  color: #111827;
}

.block-text h4 {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  color: #1f2937;
}

.block-text p {
  margin: 0 0 1.6rem 0;
}

.block-text ul,
.block-text ol {
  margin: 1.6rem 0;
  padding-left: 3rem;
}

.block-text li {
  margin-bottom: 0.8rem;
}

.block-text a {
  color: #2563eb;
  text-decoration: underline;
}

.block-text a:hover {
  color: #1d4ed8;
}

.block-text blockquote,
.block-html blockquote {
  position: relative;
  margin: 2.4rem 0;
  padding-left: 3.6rem;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  color: #6b7280;
}

.block-text blockquote::before,
.block-html blockquote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2rem;
  width: 2.4rem;
  height: 2.4rem;
  background-color: var(--brand-primary, #6b7280);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.031 14c3.866 0 7 3.134 7 7s-3.134 7-7 7-7-3.134-7-7l-0.031-1c0-7.732 6.268-14 14-14v4c-2.671 0-5.182 1.040-7.071 2.929-0.364 0.364-0.695 0.751-0.995 1.157 0.357-0.056 0.724-0.086 1.097-0.086zM25.031 14c3.866 0 7 3.134 7 7s-3.134 7-7 7-7-3.134-7-7l-0.031-1c0-7.732 6.268-14 14-14v4c-2.671 0-5.182 1.040-7.071 2.929-0.364 0.364-0.695 0.751-0.995 1.157 0.358-0.056 0.724-0.086 1.097-0.086z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.031 14c3.866 0 7 3.134 7 7s-3.134 7-7 7-7-3.134-7-7l-0.031-1c0-7.732 6.268-14 14-14v4c-2.671 0-5.182 1.040-7.071 2.929-0.364 0.364-0.695 0.751-0.995 1.157 0.357-0.056 0.724-0.086 1.097-0.086zM25.031 14c3.866 0 7 3.134 7 7s-3.134 7-7 7-7-3.134-7-7l-0.031-1c0-7.732 6.268-14 14-14v4c-2.671 0-5.182 1.040-7.071 2.929-0.364 0.364-0.695 0.751-0.995 1.157 0.358-0.056 0.724-0.086 1.097-0.086z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.block-text code {
  background: #f3f4f6;
  padding: 0.2rem 0.6rem;
  border-radius: 0.3rem;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.block-text pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 1.6rem;
  border-radius: 0.6rem;
  overflow-x: auto;
  margin: 2.4rem 0;
}

.block-text pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* HTML Block */
.block-html {
  padding: 0;
}

/* Thumbnail Links */
.thumb-links {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin: 2rem 0;
}

.thumb-link {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  text-decoration: none;
  color: #1f2937;
  font-size: 1.7rem;
  font-weight: 600;
  padding: 0.8rem;
  border-radius: 0.6rem;
  transition: background 0.15s;
}

.thumb-link:hover {
  background: #f3f4f6;
}

/* Video Embed */
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 3rem 0;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0.8rem;
}

/* Image Block */
.block-image {
  margin: 3rem 0;
}

.block-image-figure {
  margin: 0;
  text-align: center;
}

.block-image-img {
  max-width: 100%;
  height: auto;
  border-radius: 0.8rem;
  box-shadow: 0 0.4rem 0.6rem rgba(0, 0, 0, 0.1);
}

.block-image-caption {
  margin-top: 1.2rem;
  font-size: 1.4rem;
  color: #6b7280;
  font-style: italic;
  text-align: center;
}

.block-image-placeholder {
  padding: 4rem;
  background: #f9fafb;
  border: 0.2rem dashed #d1d5db;
  border-radius: 0.8rem;
  text-align: center;
  color: #9ca3af;
}

/* Code Block */
.block-code {
  margin: 3rem 0;
}

.code-block-wrapper {
  position: relative;
  border-radius: 0.8rem;
  overflow: hidden;
  box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.1);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.6rem;
  background: #e5e7eb;
}

.code-language {
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: 0.05em;
}

.code-copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.4rem;
  transition: all 0.15s;
  color: #6b7280;
}

.code-copy-button img {
  display: block;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.code-copy-button:hover {
  background: #d1d5db;
}

.code-copy-button:hover img {
  opacity: 1;
}

.code-copy-button.copied {
  color: #10b981;
}

.code-copy-button.copied img {
  opacity: 1;
  filter: invert(51%) sepia(79%) saturate(435%) hue-rotate(99deg) brightness(94%) contrast(87%);
}

.code-block-content {
  position: relative;
  background: #f3f4f6;
  padding: 0;
  margin: 0;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 1.4rem;
  line-height: 1.6;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 400px;
  transition: max-height 0.3s ease;
}

.code-block-content.truncated {
  max-height: 400px;
  overflow-y: hidden;
  position: relative;
}

.code-block-content.truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent, #f3f4f6);
  pointer-events: none;
}

.code-block-content.expanded {
  max-height: none;
}

.code-block-content.expanded::after {
  display: none;
}

.code-block-content code {
  display: inline-block;
  white-space: pre;
  color: #374151;
  padding: 1.6rem;
  padding-right: 2.4rem;
  min-width: 100%;
  box-sizing: border-box;
}

.code-block-expand {
  display: none;
  width: 100%;
  padding: 1rem 1.6rem;
  background: #e5e7eb;
  border: none;
  border-top: 0.1rem solid #d1d5db;
  color: #374151;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.code-block-expand:hover {
  background: #d1d5db;
}

/* Post Cards (category listing) */
.post-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
}

.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 0.6rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  transform: translateY(-0.2rem);
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.15);
}

.post-card-image img {
  width: 100%;
  height: auto;
  display: block;
}

.post-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 16rem;
  background: #f3f4f6;
  color: #9ca3af;
}

.post-card-body {
  padding: 1.6rem;
}

.post-card-title {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.8rem 0;
}

.post-card-excerpt {
  font-size: 1.4rem;
  line-height: 1.5;
  margin: 0 0 1.2rem 0;
  color: #6b7280;
}

.post-card-date {
  font-size: 1.3rem;
  color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-content {
    padding: 2rem 1.6rem;
  }

  .page-article {
    padding: 2.4rem 2rem;
    border-radius: 0;
  }

  .page-title {
    font-size: 2.8rem;
  }

  .block-text {
    font-size: 1.6rem;
  }

  .block-text h2 {
    font-size: 2.4rem;
  }

  .block-text h3 {
    font-size: 2rem;
  }

  .block-text h4 {
    font-size: 1.6rem;
  }

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

/* Product Cards (affiliate links) */
.product-card {
  display: flex;
  gap: 2rem;
  border: 0.1rem solid #d1d5db;
  border-radius: 0.8rem;
  padding: 2rem;
  margin: 2rem 0;
  background: #fff;
}

.product-card-image {
  flex-shrink: 0;
  width: 16rem;
}

.product-card-image img {
  width: 100%;
  height: auto;
  border-radius: 0.4rem;
  object-fit: cover;
}

.product-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-name {
  margin: 0 0 0.8rem;
  font-size: 1.8rem;
}

.product-card-description {
  margin: 0 0 1.2rem;
  font-size: 1.4rem;
  color: #6b7280;
  line-height: 1.5;
}

.product-card-footer {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  margin-top: auto;
}

.product-card-price {
  font-size: 1.6rem;
  font-weight: 600;
}

.product-card-link {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 0.4rem;
  font-size: 1.4rem;
  font-weight: 500;
  text-decoration: none;
  border: 0.1rem solid currentColor;
}

/* Product Link (compact inline) */
.product-link {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  padding: 0.4rem 0;
}

.product-link-thumb {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.4rem;
  object-fit: cover;
  flex-shrink: 0;
}

.product-link-name {
  font-weight: 500;
}

@media (max-width: 820px) {
  .product-card {
    flex-direction: column;
  }

  .product-card-image {
    width: 100%;
  }
}
