/* ==========================================================================
   runcastle.dev content pages
   --------------------------------------------------------------------------
   Article layout for the docs and comparison pages. styles.css owns the
   design tokens, the reset, and the shared header/footer chrome; this file
   only adds the long-form reading surface on top and defines no colours of
   its own — every value below resolves to a :root custom property.

   Loaded WITHOUT main.js, so nothing here may depend on a runtime class
   (no .reveal, no .is-stuck).
   ========================================================================== */

:root {
  /* Long-form measure. Roughly 70 characters at the body size, which is the
     middle of the comfortable range for a single column of Inter. */
  --measure: 72ch;
}

/* ==========================================================================
   PAGE FRAME
   ========================================================================== */

.article {
  /* The gutter is padding inside the box, so add it back: --measure is the
     measure of the text, not of the column plus its margins. */
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: 56px 96px;
  /* Long identifiers (env var names, paths) break rather than push the page
     wider than the viewport on a phone. */
  overflow-wrap: break-word;
}

/* Breadcrumb / back-to-home. Sits above the h1 and is the only chrome
   between the sticky nav and the article. */
.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-3);
}
.crumbs a {
  color: var(--text-2);
  transition: color var(--dur-1) var(--ease);
}
.crumbs a:hover {
  color: var(--text);
}
.crumbs-sep {
  color: var(--text-4);
}
.crumbs [aria-current='page'] {
  color: var(--text-3);
}

/* ==========================================================================
   TYPE SCALE
   ========================================================================== */

.article h1 {
  font-size: clamp(30px, 5.2vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 18px;
}

.article-lede {
  font-size: 18px;
  line-height: 1.62;
  color: var(--text-2);
  margin: 0 0 40px;
}

.article h2 {
  font-size: clamp(21px, 3vw, 25px);
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 52px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline-soft);
}

.article h3 {
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 30px 0 10px;
}

.article p {
  margin: 0 0 18px;
}

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

.article a {
  color: var(--accent-hi);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-1) var(--ease);
}
.article a:hover {
  text-decoration-color: var(--accent-hi);
}

/* ==========================================================================
   LISTS
   ========================================================================== */

.article ul,
.article ol {
  margin: 0 0 18px;
  padding-left: 22px;
}
.article li {
  margin-bottom: 8px;
}
.article li::marker {
  color: var(--text-4);
}

/* ==========================================================================
   CODE
   ========================================================================== */

.article code {
  font-family: var(--mono);
  font-variant-ligatures: none;
  font-size: 0.88em;
  color: var(--text);
  background: var(--panel-3);
  border: 1px solid var(--hairline-soft);
  border-radius: 5px;
  padding: 1px 5px;
}

.article pre {
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--panel-inset);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-panel);
  overflow-x: auto;
  font-family: var(--mono);
  font-variant-ligatures: none;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.article pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
/* A shell prompt inside a code block: dim, and not part of a copied line. */
.article pre .pre-prompt {
  color: var(--text-4);
  user-select: none;
}
.article pre .pre-comment {
  color: var(--text-3);
}

/* ==========================================================================
   TABLES
   ========================================================================== */

.article .table-scroll {
  overflow-x: auto;
  margin: 0 0 22px;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.article th,
.article td {
  text-align: left;
  vertical-align: top;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline-soft);
}
.article th {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom-color: var(--hairline);
}
.article tbody tr:last-child td {
  border-bottom: 0;
}

/* ==========================================================================
   CALLOUT
   ========================================================================== */

.note {
  margin: 0 0 22px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-panel);
  color: var(--text-2);
  font-size: 15px;
}
.note :last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   DOCS SUB-NAV
   --------------------------------------------------------------------------
   The three docs pages carry this so every one is a hop from every other,
   including on narrow screens where the header's .nav-links is hidden.
   ========================================================================== */

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 40px;
}
.subnav a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding-inline: 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
    background var(--dur-1) var(--ease);
}
.subnav a:hover {
  color: var(--text);
  border-color: var(--hairline-strong);
  background: var(--panel-3);
}
.subnav a[aria-current='page'] {
  color: var(--accent-hi);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* ==========================================================================
   NEXT LINKS  (the pair of cards that close every article)
   ========================================================================== */

.next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 52px;
}
.next a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-panel);
  background: var(--panel-2);
  text-decoration: none;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.next a:hover {
  border-color: var(--hairline-strong);
  background: var(--panel-3);
}
.next-k {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-4);
  margin-bottom: 5px;
}
.next-t {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

/* ==========================================================================
   NARROW SCREENS
   ========================================================================== */

@media (max-width: 620px) {
  .article {
    padding-block: 36px 72px;
  }
  .article-lede {
    font-size: 17px;
    margin-bottom: 32px;
  }
  .article h2 {
    margin-top: 42px;
  }
}
