/* ============================================================
   ARTICLE.CSS -- Blog post page, content renderer, TOC, author bar
   Gadgets World Modern UI
   ============================================================ */

/* Post page wrapper */
.post-page { padding: var(--sp-10) 0 var(--sp-12); }

/* Three-column layout: TOC | Content | Sidebar */
.post-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: var(--sp-6);
  align-items: start;
}
/* Prevent grid children from overflowing their columns */
.post-layout > * { min-width: 0; }

/* Left TOC column -- sticky */
.post-toc-column {
  position: sticky;
  top: calc(var(--header-height) + var(--sp-5));
  max-height: calc(100vh - var(--header-height) - var(--sp-10));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}
.post-toc-column::-webkit-scrollbar { width: 3px; }
.post-toc-column::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 3px; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-muted); transition: color var(--t-base); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { color: var(--color-border); }
.breadcrumb .current {
  color: var(--color-text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}

/* ============================================================
   Hero image
   ============================================================ */
.post-hero-img {
  width: 100%;
  height: 440px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-8);
  box-shadow: var(--shadow-md);
}

/* ============================================================
   Post title
   ============================================================ */
.post-title {
  font-family: var(--font-heading);
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: var(--sp-6);
  letter-spacing: -0.5px;
}

/* ============================================================
   Author bar
   ============================================================ */
.author-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--sp-8);
  flex-wrap: wrap;
  overflow: hidden;
}

.author-avatar {
  width: 46px; height: 46px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-heading);
  box-shadow: 0 2px 8px rgba(249,115,22,0.3);
}

.author-meta { display: flex; flex-direction: column; gap: 2px; }
.author-name { font-weight: 600; font-size: 14px; color: var(--color-text); }
.post-meta-info {
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}
.post-meta-info .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.author-bar-share {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex-shrink: 0;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--t-base);
  text-decoration: none;
}
.share-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(249,115,22,0.3);
  transform: translateY(-1px);
}

/* ============================================================
   TOC -- Desktop
   ============================================================ */
.toc-wrapper {
  background: linear-gradient(135deg, var(--color-bg-secondary), #f0f9ff);
  border: 1px solid rgba(249,115,22,0.15);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  transition: background var(--t-base), border-color var(--t-base);
}

.toc-heading {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-list li a {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: block;
  border-left: 2px solid transparent;
  transition: all var(--t-base);
  line-height: 1.4;
}
.toc-list li a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-left-color: var(--color-primary);
}
.toc-list li.toc-h3 a { padding-left: var(--sp-6); font-size: 13px; }

/* TOC mobile accordion */
.toc-accordion {
  display: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-8);
  overflow: hidden;
}
.toc-accordion-btn {
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-bg-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  transition: background var(--t-base);
}
.toc-accordion-btn .chevron { transition: transform var(--t-base); }
.toc-accordion-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.toc-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-base);
  background: var(--color-bg);
}
.toc-accordion-content.open { max-height: 500px; }
.toc-accordion-content .toc-list { padding: var(--sp-4) var(--sp-5); }

/* ============================================================
   Post Content -- block rendering
   ============================================================ */
.post-content {
  font-size: var(--font-size-base);
  color: var(--color-text);
  line-height: var(--line-height-body);
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.post-content h2 {
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--color-border);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.post-content h3 {
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-4);
  color: var(--color-primary-dark);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.post-content p { margin-bottom: var(--sp-5); }
.post-content ul,
.post-content ol { margin-bottom: var(--sp-5); }
.post-content li { margin-bottom: var(--sp-2); color: var(--color-text-secondary); }

/* Styled list */
.post-content ul li::marker { color: var(--color-primary); }
.post-content ol li::marker { color: var(--color-primary); font-weight: 700; }

/* Content image */
.content-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin: var(--sp-8) 0;
  max-height: 500px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
}

/* Content table */
.content-table-wrapper {
  overflow-x: auto;
  margin: var(--sp-8) 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.content-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}
.content-table th {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  padding: 13px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.content-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: background var(--t-base);
}
.content-table tbody tr:nth-child(even) td { background: var(--color-bg-secondary); }
.content-table tbody tr:last-child td { border-bottom: none; }
.content-table tbody tr:hover td { background: var(--color-primary-light); }

/* Callout */
.callout {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin: var(--sp-8) 0;
  font-size: 15px;
}
.callout.callout-info { background: var(--callout-info-bg); border-left-color: var(--callout-info-border); }
.callout.callout-tip  { background: var(--callout-tip-bg);  border-left-color: var(--callout-tip-border);  }
.callout.callout-warning { background: var(--callout-warning-bg); border-left-color: var(--callout-warning-border); }
.callout-icon { font-size: 20px; line-height: 1.5; flex-shrink: 0; }
.callout-text { flex: 1; line-height: 1.7; color: var(--color-text); margin: 0; }

/* Quote */
.content-quote {
  position: relative;
  margin: var(--sp-8) 0;
  padding: var(--sp-8) var(--sp-8) var(--sp-6) calc(var(--sp-8) + var(--sp-4));
  border-left: 4px solid var(--color-primary);
  background: linear-gradient(135deg, var(--color-bg-secondary), #f0f9ff);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.content-quote::before {
  content: '\201C';
  position: absolute;
  top: -14px; left: var(--sp-4);
  font-size: 80px;
  font-family: var(--font-heading);
  color: var(--color-primary);
  opacity: 0.3;
  line-height: 1;
}
.content-quote blockquote {
  font-style: italic;
  font-size: clamp(16px, 2vw, 19px);
  font-family: var(--font-heading);
  color: var(--color-text);
  margin-bottom: var(--sp-3);
  line-height: 1.6;
}
.content-quote cite {
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: normal;
  font-weight: 500;
}

/* FAQ items */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-3);
  overflow: hidden;
  transition: border-color var(--t-base);
}
.faq-item:hover { border-color: rgba(249,115,22,0.3); }

.faq-question {
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-bg-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  transition: background var(--t-base);
  font-family: var(--font-body);
  line-height: 1.5;
}
.faq-question:hover { background: var(--color-primary-light); }
.faq-question .faq-icon { flex-shrink: 0; transition: transform var(--t-base); color: var(--color-primary); }
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-base), padding var(--t-base);
  background: var(--color-bg);
}
.faq-answer.open {
  max-height: 300px;
}
.faq-answer-inner {
  padding: var(--sp-4) var(--sp-5);
  color: var(--color-text-secondary);
  font-size: 14.5px;
  line-height: 1.7;
}

/* Subsection block */
.subsection-block {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  transition: background var(--t-base), border-color var(--t-base);
}
.subsection-block:hover { border-color: rgba(249,115,22,0.25); }
.subsection-title {
  font-family: var(--font-heading);
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.subsection-title::before {
  content: '';
  width: 4px; height: 18px;
  background: linear-gradient(180deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

/* ============================================================
   You May Also Like
   ============================================================ */
.also-like-section {
  margin-top: var(--sp-12);
  padding-top: var(--sp-8);
  border-top: 2px solid var(--color-border);
}
.also-like-title {
  font-family: var(--font-heading);
  font-size: clamp(20px, 3vw, 26px);
  color: var(--color-text);
  margin-bottom: var(--sp-6);
}
.also-like-scroll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

/* Ad slot inline */
.ad-slot-article {
  margin: 0;
  min-height: 0;
  display: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1199px) {
  .post-layout { grid-template-columns: 1fr 280px; }
  .post-toc-column { display: none; }
  .toc-accordion { display: block; }
}
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-toc-column { position: static; max-height: none; overflow: visible; display: block; }
  .toc-wrapper { display: none; }
  .toc-accordion { display: block; }
  .also-like-scroll { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .post-hero-img { height: 260px; border-radius: var(--radius-md); }
  .toc-wrapper { display: none; }
  .toc-accordion { display: block; }
  .author-bar-share { margin-left: 0; width: 100%; }
  .also-like-scroll { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .also-like-scroll { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .post-hero-img { height: 200px; }
  .breadcrumb .current { max-width: 180px; }
  .post-title { font-size: clamp(22px, 6vw, 30px); }
  .author-bar { flex-wrap: wrap; }
  .post-meta-info { flex-wrap: wrap; }
}
