/* ============================================================
   blog-article.css — Redesigned article page & typography
   Tokens: base.css / tokens.css
   ============================================================ */

/* ------------------------------------------------------------
   1. Article Container & Layout
   ------------------------------------------------------------ */
.s-article {
  max-width: 1200px;
  padding-block: var(--space-8) var(--space-12);
  margin-inline: auto;
}

/* Breadcrumbs */
.s-article__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-13);
  color: var(--fg-3);
  margin-bottom: var(--space-6);
}
.s-article__crumbs a {
  color: var(--fg-3);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}
.s-article__crumbs a:hover {
  color: var(--accent);
}
.s-article__crumbs .crumb-sep {
  color: var(--border-2);
  font-size: 11px;
}
.s-article__crumbs .crumb-current {
  color: var(--fg-2);
  font-weight: var(--fw-medium);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Header Tags */
.s-article__header {
  margin-bottom: var(--space-6);
}
.s-article__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.badge--category {
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
  font-weight: var(--fw-semibold);
}
.badge--readtime {
  background: var(--surface-2);
  color: var(--fg-2);
}
.badge--fresh {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  font-weight: var(--fw-medium);
}

/* Title */
.s-article__title {
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--fg-1);
  margin: 0 0 var(--space-6);
}

/* Meta bar */
.s-article__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
  font-size: var(--fs-14);
}
.s-article__author-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.author-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.author-details {
  display: flex;
  flex-direction: column;
}
.author-name {
  font-weight: var(--fw-bold);
  color: var(--fg-1);
  line-height: 1.2;
}
.author-role {
  font-size: var(--fs-12);
  color: var(--fg-3);
}

.s-article__date-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.date-item {
  color: var(--fg-3);
}
.date-item time {
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.changelog-dropdown summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: var(--fw-medium);
  user-select: none;
  font-size: var(--fs-13);
}
.changelog-dropdown summary:hover {
  text-decoration: underline;
}
.changelog-dropdown ul {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-4);
  font-size: var(--fs-13);
  color: var(--fg-2);
}

/* ------------------------------------------------------------
   2. Media Grid (TOC left + Cover right on desktop)
   ------------------------------------------------------------ */
.s-article__media-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-6);
  align-items: stretch;
  margin-bottom: var(--space-8);
}
.s-article__media-grid--no-toc {
  grid-template-columns: 1fr;
}

.s-article__media-grid .s-article__toc {
  margin-bottom: 0;
  height: 100%;
  box-sizing: border-box;
}

.s-article__media-grid .s-article__cover {
  margin-bottom: 0;
  max-height: none;
  height: 100%;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.s-article__media-grid .s-article__cover img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  max-height: 360px;
  object-fit: cover;
  object-position: center 25%;
  display: block;
}

/* Standalone TOC fallback */
.s-article__toc {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--space-5) var(--space-6);
}
.toc-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-16);
  font-weight: var(--fw-bold);
  color: var(--fg-1);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-1);
}
.toc-header svg {
  color: var(--accent);
}
.toc-list {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toc-list li a {
  color: var(--fg-2);
  text-decoration: none;
  font-size: var(--fs-14);
  line-height: 1.45;
  transition: color var(--t-fast) var(--ease-out);
}
.toc-list li a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ------------------------------------------------------------
   3. Body Typography
   ------------------------------------------------------------ */
.s-article__body {
  font-size: 17px;
  line-height: 1.75;
  color: var(--fg-2);
}
.s-article__body h2 {
  font-size: clamp(22px, 3.2vw, 30px);
  line-height: 1.25;
  font-weight: 700;
  color: var(--fg-1);
  margin: var(--space-10) 0 var(--space-4);
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
}
.s-article__body h3 {
  font-size: clamp(18px, 2.4vw, 22px);
  line-height: 1.35;
  font-weight: 600;
  color: var(--fg-1);
  margin: var(--space-8) 0 var(--space-3);
  scroll-margin-top: 80px;
}
.s-article__body p {
  margin-bottom: var(--space-5);
}
.s-article__body ul,
.s-article__body ol {
  margin-bottom: var(--space-6);
  padding-left: var(--space-6);
}
.s-article__body li {
  margin-bottom: var(--space-2);
}

/* ------------------------------------------------------------
   4. TL;DR & Blockquotes
   ------------------------------------------------------------ */
.tldr {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}
.tldr strong {
  display: block;
  font-size: var(--fs-13);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--accent-soft-fg);
  margin-bottom: var(--space-3);
}
.tldr ul {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--fg-1);
}
.tldr li {
  margin-bottom: var(--space-2);
  line-height: 1.6;
}

.s-article__body blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-6) var(--space-5) var(--space-8);
  background: var(--surface-1);
  border-left: 4px solid var(--fg-1);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-style: italic;
  color: var(--fg-2);
}

/* ------------------------------------------------------------
   5. Tables & Steps
   ------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-8);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-1);
}
.table-wrap table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--fs-14);
}
.table-wrap table th {
  background: var(--surface-1);
  color: var(--fg-1);
  font-weight: var(--fw-bold);
  text-align: left;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-1);
}
.table-wrap table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-1);
  vertical-align: top;
}
.table-wrap table tr:hover td {
  background: var(--surface-1);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
  counter-reset: steps-counter;
}
.steps > li {
  position: relative;
  padding-left: var(--space-10);
  padding-bottom: var(--space-6);
  border-left: 2px solid var(--border-1);
  margin-left: var(--space-5);
  counter-increment: steps-counter;
}
.steps > li::before {
  content: counter(steps-counter);
  position: absolute;
  left: calc(-1 * var(--space-5) - 16px);
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------------------------------------
   6. Jobs Widget in Article
   ------------------------------------------------------------ */
.s-article__jobs-widget {
  background: linear-gradient(135deg, rgba(255,84,54,0.06), rgba(255,255,255,0));
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  margin: var(--space-10) 0;
}
.jobs-widget__header h2 {
  font-size: var(--fs-20);
  font-weight: var(--fw-bold);
  color: var(--fg-1);
  margin: 0 0 var(--space-1);
}
.jobs-widget__header p {
  font-size: var(--fs-14);
  color: var(--fg-3);
  margin: 0 0 var(--space-5);
}
.jobs-widget__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--space-3);
}
.jobs-widget__card {
  background: var(--surface-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.jobs-widget__card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.jobs-widget__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.jobs-widget__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.jobs-widget__name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-14);
  color: var(--fg-1);
}
.jobs-widget__income {
  display: flex;
  flex-direction: column;
}
.income-val {
  font-weight: var(--fw-bold);
  color: var(--accent);
  font-size: var(--fs-14);
}
.income-sub {
  font-size: var(--fs-12);
  color: var(--fg-3);
}

/* ------------------------------------------------------------
   7. Rating & Share Bar
   ------------------------------------------------------------ */
.s-article__share {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--surface-1);
  border-radius: var(--r-md);
  margin-bottom: var(--space-8);
}
.share-rating {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.rating-stars {
  color: #f59e0b;
  font-size: 18px;
  letter-spacing: 2px;
}
.rating-text {
  font-size: var(--fs-14);
  color: var(--fg-2);
}
.btn-share {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: var(--surface-0);
  color: var(--fg-1);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
}
.btn-share:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ------------------------------------------------------------
   8. Related Articles Grid
   ------------------------------------------------------------ */
.s-article__related-grid {
  margin-top: var(--space-10);
  border-top: 1px solid var(--border-1);
  padding-top: var(--space-8);
}
.s-article__related-grid h2 {
  font-size: clamp(20px, 3vw, 24px);
  font-weight: var(--fw-bold);
  color: var(--fg-1);
  margin-bottom: var(--space-6);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-5);
}
.related-card {
  background: var(--surface-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}
.related-card__img {
  height: 125px;
  overflow: hidden;
  background: var(--surface-2);
}
.related-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform var(--t-medium) var(--ease-out);
}
.related-card:hover .related-card__img img {
  transform: scale(1.05);
}
.related-card__content {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.related-card__badge {
  font-size: var(--fs-12);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}
.related-card__title {
  font-size: var(--fs-15);
  font-weight: var(--fw-bold);
  color: var(--fg-1);
  line-height: 1.35;
  margin: 0;
}

/* ------------------------------------------------------------
   9. Responsive
   ------------------------------------------------------------ */
@media (max-width: 820px) {
  .s-article {
    padding-block: var(--space-6);
  }
  .s-article__media-grid {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-4);
  }
  .s-article__media-grid .s-article__cover img {
    max-height: 220px;
  }
  .s-article__meta {
    flex-direction: column;
    align-items: flex-start;
  }
  .s-article__share {
    flex-direction: column;
    align-items: flex-start;
  }
  .jobs-widget__grid {
    grid-template-columns: 1fr;
  }
}
