/* ============================================================
   Nexion — Articles
   Index grid + long-form article page. Loaded only on
   articles.html and articles/*.html.
   ============================================================ */

/* ================= Reading progress ================= */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: transparent;
  pointer-events: none;
}

.read-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--grad-brand);
  box-shadow: 0 0 12px var(--glow);
  transition: width 0.1s linear;
}

/* ================= Index: filters + grid ================= */
.art-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 999px) {
  .art-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .art-grid { grid-template-columns: 1fr; }
}

.art-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-md);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.art-card.hidden {
  display: none;
}

/* Featured card spans the full row on wide screens */
.art-card.featured {
  grid-column: 1 / -1;
}

@media (min-width: 1000px) {
  .art-card.featured {
    flex-direction: row;
    align-items: stretch;
  }

  .art-card.featured .art-card-visual {
    flex: 0 0 44%;
    aspect-ratio: auto;
  }

  .art-card.featured .art-card-body {
    justify-content: center;
    padding: 2.4rem;
  }

  .art-card.featured h3 {
    font-size: 1.6rem;
  }
}

.art-card-visual {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--border);
}

.art-card-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}

.art-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.5rem;
}

.art-card h3 {
  font-size: 1.15rem;
  line-height: 1.4;
  transition: color var(--dur);
}

.art-card:hover h3 {
  color: var(--accent-bright);
}

.art-card p {
  flex: 1;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.art-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.art-card-meta .dot-sep::before {
  content: "·";
  margin-right: 0.5rem;
  opacity: 0.5;
}

/* Category chip */
.art-cat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid rgba(74, 92, 240, 0.22);
}

.art-cat[data-cat="cloud"] {
  color: var(--status-custom);
  background: var(--status-custom-soft);
  border-color: rgba(34, 211, 238, 0.22);
}

.art-cat[data-cat="ai"] {
  color: var(--accent-bright);
}

.art-cat[data-cat="devtools"] {
  color: var(--status-live);
  background: var(--status-live-soft);
  border-color: rgba(52, 211, 153, 0.22);
}

/* Whole-card link overlay — keeps the card one tap target */
.art-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ================= Article page: hero ================= */
.article-hero {
  position: relative;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 6vw, 4.5rem));
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
  overflow: hidden;
  isolation: isolate;
}

.article-hero .container {
  position: relative;
  z-index: 2;
  max-width: 820px;
}

.article-hero h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.22;
  margin: 0.9rem 0 1rem;
}

.article-hero .lead {
  font-size: 1.05rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--dur);
}

.breadcrumb a:hover {
  color: var(--accent-bright);
}

.breadcrumb svg {
  width: 12px;
  height: 12px;
  opacity: 0.45;
}

.art-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

.art-byline strong {
  color: var(--text);
  font-weight: 500;
}

/* ================= Article page: layout ================= */
/* The table of contents comes first in the DOM so it lands above the article
   on narrow screens, then is placed into the right-hand column on wide ones. */
.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 3.5rem;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
  padding-bottom: var(--section-pad);
}

.article-wrap > .art-toc {
  grid-column: 2;
  grid-row: 1;
}

.article-wrap > .art-main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

@media (max-width: 1023px) {
  .article-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    max-width: 780px;
  }

  .article-wrap > .art-toc,
  .article-wrap > .art-main {
    grid-column: 1;
    grid-row: auto;
  }
}

/* Table of contents */
.art-toc {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  font-size: var(--fs-small);
}

.art-toc h2 {
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.art-toc ol {
  list-style: none;
  border-left: 1px solid var(--border);
}

.art-toc a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  line-height: 1.45;
  transition: color var(--dur), border-color var(--dur);
}

.art-toc a:hover {
  color: var(--text);
}

.art-toc a.active {
  color: var(--accent-bright);
  border-left-color: var(--accent);
}

@media (max-width: 1023px) {
  .art-toc {
    position: static;
    margin-bottom: 2.5rem;
    padding: 1.2rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
  }

  .art-toc ol {
    border-left: none;
  }

  .art-toc a {
    padding-left: 0;
    border-left: none;
  }

  .art-toc a.active {
    border-left: none;
  }
}

/* ================= Answer box (AEO) ================= */
.answer-box {
  position: relative;
  padding: 1.5rem 1.6rem;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.answer-box::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--grad-brand);
}

.answer-box h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.7rem;
}

.answer-box h2 svg {
  width: 15px;
  height: 15px;
}

.answer-box p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0;
}

/* ================= Article body typography ================= */
.art-body {
  font-size: 1.02rem;
  line-height: 1.85;
}

.art-body > p {
  margin-bottom: 1.35rem;
  color: var(--text-muted);
}

.art-body > p.lead {
  font-size: 1.12rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 2rem;
}

.art-body h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  line-height: 1.3;
  margin: 3rem 0 1.1rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.art-body h2:first-child {
  margin-top: 0;
}

.art-body h3 {
  font-size: 1.18rem;
  line-height: 1.45;
  margin: 2.1rem 0 0.8rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.art-body a:not(.btn) {
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(123, 138, 255, 0.4);
  transition: text-decoration-color var(--dur);
}

.art-body a:not(.btn):hover {
  text-decoration-color: var(--accent-bright);
}

.art-body strong {
  color: var(--text);
  font-weight: 600;
}

.art-list,
.art-steps {
  margin: 0 0 1.5rem;
  padding-left: 0;
  list-style: none;
  color: var(--text-muted);
}

.art-list li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.6rem;
}

.art-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0.35rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.art-steps {
  counter-reset: step;
}

.art-steps > li {
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 1rem;
  counter-increment: step;
}

.art-steps > li::before {
  content: counter(step);
  position: absolute;
  top: 0.25em;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid rgba(74, 92, 240, 0.22);
  border-radius: 50%;
}

.art-steps > li strong {
  display: block;
}

/* Callouts */
.callout {
  position: relative;
  padding: 1.15rem 1.3rem;
  margin: 1.8rem 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}

.callout p {
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.7;
  color: var(--text);
}

.callout p + p {
  margin-top: 0.6rem;
}

.callout.warn {
  border-left-color: var(--status-wip);
  background: var(--status-wip-soft);
}

/* Tables */
.table-wrap {
  margin: 1.8rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.table-wrap th,
.table-wrap td {
  padding: 0.8rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.table-wrap thead th {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  white-space: nowrap;
}

.table-wrap tbody td {
  color: var(--text-muted);
  line-height: 1.65;
}

.table-wrap tbody td:first-child {
  color: var(--text);
  font-weight: 500;
}

.table-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* Code blocks */
.art-body pre.code {
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  -webkit-overflow-scrolling: touch;
}

.art-body :not(pre) > code {
  padding: 0.15em 0.42em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.87em;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border-radius: 5px;
  white-space: nowrap;
}

/* ================= Figures ================= */
.art-fig {
  margin: 2.2rem 0;
}

.art-fig > .fig-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-2);
  box-shadow: var(--shadow-card);
}

.art-fig figcaption {
  margin-top: 0.8rem;
  font-size: var(--fs-tiny);
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
}

.art-fig svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Terminal mock */
.term {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.75;
  background: #0b0e16;
  color: #d7dbe8;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  background: #151a26;
  border-bottom: 1px solid rgba(252, 252, 252, 0.07);
}

.term-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a4152;
}

.term-bar .dot:nth-child(1) { background: #ff5f57; }
.term-bar .dot:nth-child(2) { background: #febc2e; }
.term-bar .dot:nth-child(3) { background: #28c840; }

.term-bar .term-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: #6f7789;
}

.term-body {
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.term .c-prompt { color: #7b8aff; }
.term .c-dim    { color: #6f7789; }
.term .c-ok     { color: #34d399; }
.term .c-warn   { color: #fbbf24; }
.term .c-key    { color: #22d3ee; }
.term .c-accent { color: #a78bfa; }
.term .c-txt    { color: #fcfcfc; }

/* Light theme keeps the terminal dark on purpose — a terminal is dark. */

/* FAQ block styles live in components.css — the services page uses them too. */
.art-faq {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.art-faq > h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  margin-bottom: 1.4rem;
}

/* ================= Sources + citation (AEO / GEO) =================
   Both blocks exist for the same reason: a claim a reader — or an answer
   engine — can trace is a claim it will repeat. */
.art-sources,
.art-cite {
  margin-top: 3rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}

.art-sources > h2,
.art-cite > h2 {
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.75rem;
}

.src-intro,
.cite-intro {
  font-size: var(--fs-small);
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.src-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.35rem;
  list-style: decimal;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--text-muted);
}

.src-list li::marker {
  color: var(--text-muted);
}

.src-list a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  overflow-wrap: anywhere;
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.src-list a:hover {
  color: var(--accent-bright);
  border-bottom-color: var(--accent-bright);
}

.src-note {
  display: block;
  color: var(--text-muted);
}

.cite-line {
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-small);
  line-height: 1.7;
  color: var(--text);
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

/* The Markdown/llms.txt pointers stay in the markup for crawlers — the head's
   rel="alternate" links and robots.txt are what actually advertise them, so
   there is no reason to spend a line of the reader's attention on it. */
.cite-alt {
  display: none;
  margin-top: 0.8rem;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.cite-alt a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
}

.cite-alt a:hover {
  color: var(--accent-bright);
  border-bottom-color: var(--accent-bright);
}

/* ================= Author + share + related ================= */
.art-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
  margin-top: 3rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.art-foot .art-avatar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-brand);
}

.art-foot .art-avatar svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.art-foot .art-author-txt {
  flex: 1 1 240px;
}

.art-foot h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.art-foot p {
  font-size: var(--fs-tiny);
  line-height: 1.65;
  color: var(--text-muted);
}

.art-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.art-share a,
.art-share button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  transition: color var(--dur), border-color var(--dur);
}

.art-share a:hover,
.art-share button:hover {
  color: var(--accent-bright);
  border-color: var(--accent);
}

.art-share svg {
  width: 16px;
  height: 16px;
}

.art-related {
  margin-top: 3.5rem;
}

.art-related > h2 {
  font-size: 1.3rem;
  margin-bottom: 1.4rem;
}

.art-related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .art-related-grid { grid-template-columns: 1fr; }
}

.art-related-grid a {
  position: relative;
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur), transform var(--dur);
}

.art-related-grid a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.art-related-grid strong {
  display: block;
  margin: 0.5rem 0 0.25rem;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--text);
}

.art-related-grid span.r-meta {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}

/* Inline CTA inside the article flow */
.art-cta {
  position: relative;
  margin: 3rem 0 0;
  padding: 2rem;
  overflow: hidden;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.art-cta h2 {
  font-size: 1.35rem;
  margin-bottom: 0.6rem;
}

.art-cta p {
  max-width: 46ch;
  margin: 0 auto 1.4rem;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* ================= Sources (GEO) =================
   Generative engines favour pages that show their receipts, and a reader can
   only check a claim if the link is on the page. */
.art-sources {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.art-sources > h2 {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
}

.src-intro {
  font-size: var(--fs-small);
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

.src-list {
  counter-reset: src;
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2rem;
}

@media (max-width: 720px) {
  .src-list { columns: 1; }
}

.src-list li {
  counter-increment: src;
  break-inside: avoid;
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: 0.8rem;
  font-size: var(--fs-tiny);
  line-height: 1.6;
}

.src-list li::before {
  content: counter(src);
  position: absolute;
  top: 0.1rem;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 50%;
}

.src-list a {
  color: var(--accent-bright);
  text-decoration: none;
  word-break: break-word;
}

.src-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.src-list .src-note {
  display: block;
  color: var(--text-muted);
}
