/* ================================================================
   TecPower — Article & Content Styles
   تنسيق المقالات، المحتوى، الجداول، الفهرس
   ================================================================ */

/* ── Icons: تكبير أيقونات الخدمات ── */
.service .idx > span:last-child,
.service.feature .idx > span:last-child {
  font-size: 36px;
  line-height: 1;
}
.idx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════
   ARTICLE HEADER
═══════════════════════════════════════════════════════ */

.art-hero {
  background: linear-gradient(160deg, #FAF9F7 0%, #f0ece6 100%);
  padding: 80px 0 56px;
  border-bottom: 1px solid var(--line-light, #E5E0D8);
}

.art-hero__inner {
  max-width: 900px;
}

/* Breadcrumb */
.art-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.art-breadcrumb a {
  color: var(--copper);
  text-decoration: none;
  transition: opacity .2s;
}
.art-breadcrumb a:hover { opacity: .75; }
.art-breadcrumb span[aria-hidden] { color: var(--muted); opacity: .5; }

/* Kicker */
.art-kicker { margin-bottom: 20px; }

/* Article Title */
.art-title {
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 20px;
}

/* Excerpt */
.art-excerpt {
  font-size: clamp(17px, 1.5vw, 20px);
  color: var(--muted);
  line-height: 1.7;
  max-width: 70ch;
  margin-bottom: 28px;
}

/* Meta Row */
.art-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
  padding-top: 24px;
  border-top: 1px solid var(--line-light, #E5E0D8);
}
.art-meta__item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.art-meta__icon { font-size: 16px; }
.art-meta a { color: var(--copper); text-decoration: none; }

/* ═══════════════════════════════════════════════════════
   ARTICLE BODY LAYOUT
═══════════════════════════════════════════════════════ */

.art-body {
  padding-top: 56px;
  padding-bottom: 80px;
}

/* Featured Image */
.art-thumbnail {
  margin: 0 0 48px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.08);
  aspect-ratio: 16 / 6;
}
.art-thumbnail__img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}
.art-thumbnail__caption {
  padding: 12px 20px;
  background: rgba(0,0,0,0.04);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* Two-column layout: content + sidebar */
.art-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  align-items: start;
}

@media (max-width: 900px) {
  .art-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .art-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
  }
  .art-sidebar__card { flex: 1 1 280px; }
  .art-sidebar__card--cta { text-align: right; }
  .art-cta-icon { font-size: 28px; margin-bottom: 10px; }
}

/* ═══════════════════════════════════════════════════════
   ENTRY CONTENT — محتوى المقال والصفحات
═══════════════════════════════════════════════════════ */

.art-content,
.entry-content,
.page-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  max-width: 72ch;
}

/* Paragraphs */
.entry-content p, .page-content p {
  margin-bottom: 1.6em;
}

/* ── HEADINGS ── */
.entry-content h2, .page-content h2 {
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 700;
  color: var(--ink);
  margin: 2.5em 0 0.7em;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--copper);
  letter-spacing: -0.01em;
  line-height: 1.35;
  position: relative;
}

.entry-content h3, .page-content h3 {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
  color: var(--ink);
  margin: 2em 0 0.6em;
  padding-right: 16px;
  border-right: 4px solid var(--copper);
  line-height: 1.4;
}


.entry-content h4 {
  font-size: clamp(16px, 1.5vw, 20px);
  font-weight: 700;
  color: var(--ink);
  margin: 1.8em 0 0.5em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.entry-content h4::before {
  content: "◆";
  font-size: 10px;
  color: var(--copper);
  flex-shrink: 0;
}

.entry-content h5, .entry-content h6 {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  margin: 1.5em 0 0.5em;
  text-transform: none;
}

/* ── LISTS: نقاط وأرقام ── */
.entry-content ul, .page-content ul,
.entry-content ol, .page-content ol {
  margin: 1.4em 0 1.8em;
  padding-right: 0;
  padding-left: 0;
  list-style: none;
}

.entry-content ul > li, .page-content ul > li {
  position: relative;
  padding-right: 32px;
  margin-bottom: 12px;
  line-height: 1.7;
}
.entry-content ul > li::before, .page-content ul > li::before {
  content: "✦";
  position: absolute;
  right: 0;
  top: 4px;
  color: var(--copper);
  font-size: 13px;
  font-weight: 700;
}

.entry-content ol:not(.tp-toc__list), .page-content ol:not(.tp-toc__list) {
  counter-reset: tp-ol;
}
.entry-content ol:not(.tp-toc__list) > li, .page-content ol:not(.tp-toc__list) > li {
  position: relative;
  padding-right: 44px;
  margin-bottom: 12px;
  line-height: 1.7;
  counter-increment: tp-ol;
}
.entry-content ol:not(.tp-toc__list) > li::before, .page-content ol:not(.tp-toc__list) > li::before {
  content: counter(tp-ol);
  position: absolute;
  right: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  background: var(--copper);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono, monospace);
}


/* Nested lists */
.entry-content ul ul > li::before {
  content: "◦";
  font-size: 16px;
  color: var(--muted);
}
.entry-content ol:not(.tp-toc__list) ol:not(.tp-toc__list) { counter-reset: tp-ol-inner; }
.entry-content ol:not(.tp-toc__list) ol:not(.tp-toc__list) > li { counter-increment: tp-ol-inner; }
.entry-content ol:not(.tp-toc__list) ol:not(.tp-toc__list) > li::before {
  content: counter(tp-ol-inner, lower-alpha);
  background: var(--muted);
  font-size: 12px;
}

/* ── TABLES: الجداول ── */
.entry-content table, .page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 15px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

.entry-content thead, .page-content thead {
  background: linear-gradient(90deg, var(--copper), #ba00db);
  color: #fff;
}

.entry-content thead th {
  padding: 14px 20px;
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
}

.entry-content tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background .15s;
}
.entry-content tbody tr:last-child { border-bottom: none; }
.entry-content tbody tr:nth-child(even) { background: rgba(0,0,0,0.025); }
.entry-content tbody tr:hover { background: rgba(255,170,0,0.06); }

.entry-content td {
  padding: 12px 20px;
  vertical-align: middle;
  line-height: 1.5;
}
.entry-content td:first-child { font-weight: 600; }

/* Table wrapper for horizontal scroll on mobile */
.entry-content figure.wp-block-table,
.entry-content .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2em 0;
}

/* ── BLOCKQUOTE: اقتباس ── */
.entry-content blockquote {
  margin: 2em 0;
  padding: 24px 32px;
  background: linear-gradient(135deg, rgba(255,170,0,0.06) 0%, rgba(186,0,219,0.04) 100%);
  border-right: 5px solid var(--copper);
  border-radius: 0 12px 12px 0;
  font-size: 18px;
  font-style: italic;
  line-height: 1.7;
  color: var(--ink);
  position: relative;
}
.entry-content blockquote::before {
  content: "❝";
  font-size: 48px;
  color: var(--copper);
  opacity: 0.3;
  position: absolute;
  top: 8px;
  left: 20px;
  font-style: normal;
  line-height: 1;
}
.entry-content blockquote cite {
  display: block;
  margin-top: 12px;
  font-size: 14px;
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
}

/* ── CODE ── */
.entry-content code {
  font-family: var(--f-mono, monospace);
  font-size: 14px;
  background: rgba(0,0,0,0.06);
  padding: 2px 8px;
  border-radius: 4px;
  color: #ba00db;
}
.entry-content pre {
  background: #1C1917;
  color: #e5e0d8;
  padding: 24px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
  margin: 2em 0;
}
.entry-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ── CALLOUT BOXES: صناديق تنبيه ── */
.entry-content .tp-note,
.entry-content .wp-block-quote.is-style-note {
  padding: 20px 24px;
  border-radius: 12px;
  margin: 2em 0;
  font-size: 15px;
  line-height: 1.65;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.entry-content .tp-note--info {
  background: rgba(46,175,99,0.08);
  border: 1px solid rgba(46,175,99,0.2);
}
.entry-content .tp-note--warn {
  background: rgba(255,170,0,0.08);
  border: 1px solid rgba(255,170,0,0.2);
}
.entry-content .tp-note--danger {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
}
.entry-content .tp-note__icon { font-size: 22px; flex-shrink: 0; }

/* ── IMAGES IN CONTENT ── */
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1em 0;
}
.entry-content figure { margin: 2em 0; }
.entry-content figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

/* ── HR ── */
.entry-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--copper), transparent);
  margin: 3em 0;
  opacity: 0.4;
}

/* ── LINKS ── */
.entry-content a {
  color: var(--copper);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity .2s;
}
.entry-content a:hover { opacity: .75; }

/* ── Tags ── */
.art-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line-light, #E5E0D8);
  font-size: 14px;
}
.art-tags__label { color: var(--muted); font-weight: 600; }
.art-tag {
  padding: 5px 14px;
  background: rgba(255,170,0,0.1);
  border: 1px solid rgba(255,170,0,0.25);
  border-radius: 999px;
  color: var(--copper);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: .2s;
}
.art-tag:hover { background: var(--copper); color: #fff; }

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */

.art-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.art-sidebar__card {
  background: #fff;
  border: 1px solid var(--line-light, #E5E0D8);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.art-sidebar__card--cta {
  background: linear-gradient(135deg, rgba(255,170,0,0.06), rgba(186,0,219,0.04));
  border-color: rgba(255,170,0,0.2);
  text-align: center;
}
.art-cta-icon { font-size: 40px; margin-bottom: 16px; }
.art-sidebar__card--cta h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--ink);
}
.art-sidebar__card--cta p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.art-sidebar__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--copper);
}

/* Related Posts */
.art-related { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.art-related__link {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  transition: color .2s;
}
.art-related__link:hover { color: var(--copper); }
.art-related__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.art-related__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════════════════════════════
   TABLE OF CONTENTS
═══════════════════════════════════════════════════════ */

.tp-toc {
  background: linear-gradient(135deg, rgba(255,170,0,0.05), rgba(186,0,219,0.03));
  border: 1px solid rgba(255,170,0,0.2);
  border-radius: 16px;
  padding: 0;
  margin: 2em 0 2.5em;
  overflow: hidden;
  font-size: 15px;
}

.tp-toc__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(255,170,0,0.08);
  border-bottom: 1px solid rgba(255,170,0,0.15);
  cursor: pointer;
}
.tp-toc__icon { font-size: 18px; }
.tp-toc__header strong {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.tp-toc__toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  padding: 0;
  transition: transform .3s;
  line-height: 1;
}
.tp-toc__toggle[aria-expanded="false"] { transform: rotate(180deg); }

.tp-toc__list {
  list-style: none;
  padding: 16px 24px 20px;
  margin: 0;
  counter-reset: toc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-toc .tp-toc__item {
  counter-increment: toc;
}
.tp-toc__item a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.5;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .2s;
}
.tp-toc__item a::before {
  content: counter(toc);
  min-width: 24px;
  height: 24px;
  background: var(--copper);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--f-mono, monospace);
}
.tp-toc__item a:hover,
.tp-toc__item a.active {
  background: rgba(255,170,0,0.1);
  color: var(--copper);
}
.tp-toc__item a.active::before { background: var(--ink); }

/* Sub-headings (H3, H4) */
.tp-toc__item--sub {
  padding-right: 20px;
}
.tp-toc__item--sub a {
  font-size: 14px;
}
.tp-toc__item--sub a::before {
  background: rgba(255,170,0,0.4);
  color: var(--ink);
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════
   ARTICLE CTA BANNER
═══════════════════════════════════════════════════════ */

.art-cta-banner {
  background: linear-gradient(135deg, #ffaa00 0%, #ba00db 100%);
  padding: 64px 0;
  text-align: center;
  color: #fff;
  margin: 0;
}
.art-cta-banner h2 {
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}
.art-cta-banner p {
  font-size: 17px;
  opacity: .9;
  margin-bottom: 32px;
}
.art-cta-banner .cta-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.art-cta-banner .btn-primary {
  background: #fff;
  color: var(--copper);
}
.art-cta-banner .btn-ghost {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   AUTHOR BOX
═══════════════════════════════════════════════════════ */

.art-author {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px 0 64px;
  border-top: 1px solid var(--line-light, #E5E0D8);
  margin-top: 0;
}
.art-author__avatar {
  width: 72px !important;
  height: 72px !important;
  border-radius: 50% !important;
  border: 3px solid var(--copper);
  flex-shrink: 0;
}
.art-author__name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.art-author__bio {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════
   Gutenberg Blocks Enhancement
═══════════════════════════════════════════════════════ */

.entry-content .wp-block-callout,
.entry-content .wp-block-notice {
  border-radius: 12px;
  padding: 20px 24px;
  margin: 2em 0;
}

/* Separator */
.entry-content .wp-block-separator {
  border: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--copper), transparent);
  margin: 3em 0;
}

/* Image alignment */
.entry-content .alignleft { float: right; margin: 0 0 1em 2em; }
.entry-content .alignright { float: left; margin: 0 2em 1em 0; }
.entry-content .aligncenter { margin: 1.5em auto; display: block; }
.entry-content .alignwide { margin-inline: -5%; width: 110%; max-width: none; }

@media (max-width: 768px) {
  .entry-content .alignwide { margin-inline: 0; width: 100%; }
  .entry-content .alignleft,
  .entry-content .alignright { float: none; margin: 1em 0; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .art-hero { padding: 40px 0 28px; }
  .art-title { font-size: clamp(22px, 6vw, 30px); }
  .art-excerpt { font-size: 16px; }
  .art-meta { gap: 12px; font-size: 13px; }
  .art-meta__icon { font-size: 14px; }
  .art-body { padding-top: 28px; padding-bottom: 40px; }
  .art-thumbnail { border-radius: 12px; margin-bottom: 28px; }
  .art-author { flex-direction: column; text-align: center; gap: 16px; }
  .art-author__avatar { width: 56px !important; height: 56px !important; }
  .art-sidebar { flex-direction: column; }
  .art-sidebar__card { flex: 1 1 100%; }
  .art-cta-banner { padding: 40px 0; }
  .art-cta-banner h2 { font-size: clamp(18px, 5vw, 24px); }

  /* TOC: collapsed by default on mobile */
  .tp-toc { margin: 1.2em 0 1.8em; font-size: 14px; }
  .tp-toc__header { padding: 12px 16px; }
  .tp-toc__list { padding: 12px 16px 14px; gap: 6px; }
  .tp-toc__item a { font-size: 13px; padding: 5px 8px; }
  .tp-toc__item a::before { min-width: 20px; height: 20px; font-size: 11px; }

  .entry-content { font-size: 16px; }
  .entry-content table { font-size: 13px; }
  .entry-content td, .entry-content thead th { padding: 9px 12px; }
  .entry-content h2 { font-size: clamp(18px, 5vw, 24px); }
  .entry-content h3 { font-size: clamp(16px, 4vw, 20px); }
  .entry-content blockquote { padding: 16px 20px; font-size: 16px; }

  .art-tags { gap: 6px; margin-top: 32px; }
  .art-tag { font-size: 12px; padding: 4px 12px; }
}

@media (max-width: 480px) {
  .art-hero { padding: 28px 0 20px; }
  .art-breadcrumb { font-size: 12px; gap: 6px; }
  .art-meta { flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 16px; }
  .art-sidebar__card { padding: 20px; }
  .art-sidebar__card--cta { text-align: center; }
  .art-cta-banner .cta-actions { flex-direction: column; align-items: center; }
  .art-cta-banner .btn { width: 100%; justify-content: center; }
  .entry-content .alignwide { margin-inline: 0; width: 100%; }
  .tp-toc__header strong { font-size: 14px; }
}
