/* =============================================
   CodeToFun — News article (mobile-first)
   ============================================= */

.news-article-page {
  background: #f1f5f9;
  color: #0f172a;
  overflow-x: clip;
}

.news-article-main {
  padding: 0 0 calc(2.5rem + env(safe-area-inset-bottom, 0px));
}

.news-article-shell {
  width: 100%;
  max-width: 47rem;
  margin: 0 auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right, 0px)) 1.5rem max(1rem, env(safe-area-inset-left, 0px));
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.news-article-breadcrumb {
  margin: 0 0 1rem;
}

.news-article-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: #64748b;
}

.news-article-breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.4rem;
  color: #cbd5e1;
}

.news-article-breadcrumb a {
  color: #2563eb;
  text-decoration: none;
}

.news-article-breadcrumb a:hover {
  text-decoration: underline;
}

.news-article-breadcrumb [aria-current="page"] {
  color: #334155;
  font-weight: 500;
}

.news-article-kicker {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
}

.news-article-kicker:hover {
  background: #dbeafe;
}

.news-article-title {
  margin: 0 0 0.85rem;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.65rem, 6.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: #0f172a;
  text-wrap: balance;
}

.news-article-dek {
  margin: 0 0 1.15rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: #475569;
  text-wrap: pretty;
}

.news-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0.85rem 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.875rem;
  color: #64748b;
}

.news-article-meta-author {
  color: #0f172a;
  font-weight: 600;
}

.news-article-meta-sep {
  color: #cbd5e1;
}

.news-article-hero {
  margin: 0 0 1.35rem;
}

.news-article-hero img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 0.5rem;
  background: #f1f5f9;
}

.news-article-hero figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.4;
}

.news-article-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1e293b;
}

.news-article-body > * + * {
  margin-top: 1.1rem;
}

.news-article-body h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #0f172a;
}

.news-article-body h3 {
  margin-top: 1.35rem;
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #0f172a;
}

.news-article-body p,
.news-article-body li {
  text-wrap: pretty;
}

.news-article-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.news-article-body ul,
.news-article-body ol {
  padding-left: 1.25rem;
}

.news-article-body li + li {
  margin-top: 0.4rem;
}

.news-article-body pre {
  margin: 1.15rem 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

.news-article-body code {
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace;
  font-size: 0.92em;
}

.news-article-body p code,
.news-article-body li code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  background: #f1f5f9;
  color: #0f172a;
}

.news-article-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.news-article-callout {
  margin: 1.35rem 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid #2563eb;
  border-radius: 0 0.5rem 0.5rem 0;
  background: #f8fafc;
}

.news-article-callout p {
  margin: 0;
  font-size: 0.975rem;
  color: #334155;
}

.news-article-callout strong {
  color: #0f172a;
}

.news-article-takeaways {
  margin: 1.5rem 0;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.news-article-body .news-article-takeaways h2 {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.news-article-takeaways ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.975rem;
  line-height: 1.55;
}

.news-article-takeaways li::marker {
  color: #2563eb;
}

.news-article-quote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 4px solid #00a35c;
}

.news-article-quote p {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: #0f172a;
  text-wrap: pretty;
}

.news-article-quote cite {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 550;
  color: #64748b;
}

.news-article-quote cite::before {
  content: "— ";
}

.news-article-body .news-article-steps {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: news-step;
}

.news-article-body .news-article-steps li {
  position: relative;
  margin: 0;
  padding: 0.8rem 0.95rem 0.8rem 3.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  background: #fff;
  counter-increment: news-step;
}

.news-article-steps li::before {
  content: counter(news-step);
  position: absolute;
  top: 0.8rem;
  left: 0.9rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
}

.news-article-steps strong {
  display: block;
  font-size: 1rem;
  color: #0f172a;
}

.news-article-steps span {
  display: block;
  font-size: 0.925rem;
  line-height: 1.5;
  color: #475569;
}

.news-article-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0;
  padding: 1.15rem 1rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
}

.news-article-stat-item {
  display: flex;
  flex-direction: column;
  min-width: 6.5rem;
}

.news-article-stat-value {
  font-size: clamp(1.6rem, 7vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.news-article-stat-item--after .news-article-stat-value {
  color: #4ade80;
  text-decoration: none;
}

.news-article-stat-label {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #cbd5e1;
}

.news-article-stat-arrow {
  font-size: 1.5rem;
  color: #64748b;
}

.news-article-body .news-article-stat-note {
  flex-basis: 100%;
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #94a3b8;
}

.news-article-source {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #475569;
}

.news-article-body .tut-ad-slot {
  margin: 1.5rem 0;
  min-height: 90px;
  text-align: center;
  overflow: hidden;
}

.news-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.75rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid #e2e8f0;
  list-style: none;
}

.news-article-tags a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 550;
  text-decoration: none;
}

.news-article-tags a:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.news-article-footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.news-article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  color: #2563eb;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.news-article-back:hover {
  text-decoration: underline;
}

.news-article-related {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: #64748b;
}

.news-article-related a {
  color: #2563eb;
  font-weight: 550;
  text-decoration: none;
}

.news-article-related a:hover {
  text-decoration: underline;
}

/* ---------- Related News (Amazon-style card row) ---------- */
.news-related {
  margin-top: 2rem;
  padding: 1.75rem 0 calc(1.5rem + env(safe-area-inset-bottom, 0px));
  background: #f4f4f5;
  border-top: 1px solid #e4e4e7;
}

.news-related-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
}

.news-related-title {
  margin: 0 0 1.15rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #111;
}

.news-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-related-card {
  min-width: 0;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Never show more than 4 related cards */
.news-related-card:nth-child(n + 5) {
  display: none;
}

.news-related-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.news-related-card-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eee;
}

.news-related-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.news-related-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.95rem 1rem 1.05rem;
  gap: 0.45rem;
}

.news-related-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: #111;
}

.news-related-card-date {
  font-size: 0.8125rem;
  color: #6b6b6b;
  line-height: 1.3;
}

.news-related-card-tag {
  display: inline-flex;
  align-self: flex-start;
  margin-top: auto;
  padding: 0.28rem 0.55rem;
  border-radius: 0.25rem;
  background: #f0f0f0;
  color: #222;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

@media (min-width: 640px) {
  .news-related {
    margin-top: 2.5rem;
    padding-top: 2rem;
  }

  .news-related-title {
    font-size: 1.5rem;
    margin-bottom: 1.35rem;
  }

  .news-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

@media (min-width: 960px) {
  .news-related-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .news-related-card-title {
    font-size: 0.975rem;
    min-height: 5.2em;
  }
}

@media (hover: hover) and (pointer: fine) {
  .news-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  }

  .news-related-card:hover .news-related-card-media img {
    transform: scale(1.04);
  }

  .news-related-card:hover .news-related-card-title {
    color: #2563eb;
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-related-card,
  .news-related-card-media img {
    transition: none;
  }

  .news-related-card:hover {
    transform: none;
  }

  .news-related-card:hover .news-related-card-media img {
    transform: none;
  }
}

@media (min-width: 640px) {
  .news-article-shell {
    padding-top: 1.75rem;
  }

  .news-article-dek {
    font-size: 1.125rem;
  }

  .news-article-body {
    font-size: 1.075rem;
  }

  .news-article-body h2 {
    font-size: 1.5rem;
  }

  .news-article-body .news-article-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-article-quote p {
    font-size: 1.2rem;
  }

  .news-article-footer-nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 768px) {
  .news-article-shell {
    padding: 2.25rem 1.5rem 2rem;
  }

  .news-article-hero {
    margin-bottom: 1.75rem;
  }

  .news-article-body h2 {
    margin-top: 2rem;
  }
}

/* ---------- About the author (matches tutorial pages) ---------- */
.news-author {
  --tut-accent: #2563eb;
  --tut-accent-700: #1d4ed8;
  --tut-accent-border: #93c5fd;
  margin: 1.75rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.news-author .tut-author-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 1rem;
}

.news-author .tut-author-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.5rem;
  align-items: flex-start;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.news-author .tut-author-photo-wrap {
  flex-shrink: 0;
  position: relative;
  width: 7rem;
  height: 7rem;
}

.news-author .tut-author-photo {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  display: block;
}

.news-author .tut-author-aws-badge {
  position: absolute;
  right: -0.2rem;
  bottom: -0.2rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.125rem;
  border-radius: 0.375rem;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
  line-height: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.news-author .tut-author-aws-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.news-author .tut-author-aws-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.25rem;
  display: block;
}

.news-author .tut-author-body {
  flex: 1;
  min-width: min(100%, 16rem);
}

.news-author .tut-author-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.news-author .tut-author-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.news-author .tut-author-profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  border-radius: 0.25rem;
  padding: 0.15rem;
  transition: color 0.15s, background 0.15s;
}

.news-author .tut-author-profile-link:hover {
  color: #0a66c2;
  background: rgba(10, 102, 194, 0.08);
}

.news-author .tut-author-profile-link:focus-visible {
  outline: 2px solid var(--tut-accent);
  outline-offset: 2px;
}

.news-author .tut-author-profile-link-icon {
  display: block;
  flex-shrink: 0;
}

.news-author .tut-author-role {
  font-size: 0.875rem;
  color: var(--tut-accent-700);
  font-weight: 600;
  margin: 0 0 1rem;
}

.news-author .tut-author-meta {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.news-author .tut-author-meta li {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.news-author .tut-author-meta li:last-child {
  margin-bottom: 0;
}

.news-author .tut-author-meta-label {
  display: inline-block;
  min-width: 5.5rem;
  font-weight: 600;
  color: #334155;
}

.news-author .tut-author-bio {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.news-author .tut-author-credentials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-author .tut-author-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.news-author .tut-author-badge-link:hover {
  border-color: var(--tut-accent-border);
  color: var(--tut-accent-700);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.news-author .tut-author-badge-icon {
  display: flex;
  color: var(--tut-accent-700);
}

@media (max-width: 639px) {
  .news-author .tut-author-heading {
    text-align: center;
  }

  .news-author .tut-author-card {
    flex-direction: column;
    align-items: center;
    padding: 1.15rem;
  }

  .news-author .tut-author-photo-wrap {
    margin: 0 auto;
  }

  .news-author .tut-author-name-row {
    justify-content: center;
  }

  .news-author .tut-author-body {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .news-author {
    margin-top: 2rem;
  }

  .news-author .tut-author-card {
    padding: 1.5rem;
  }
}

