/*
  Articles: Insights posts (product news now, guides next).
  Structure after the Supabase blog (study in research/growth/site-redesign-home/supabase-ref):
  breadcrumb, title, meta, a narrow reading column, a sticky right rail with
  "On this page", AI tools and the app card, previous and next at the foot.
  The look is ours (brand guidelines): light page, deep ink, Eriksen green, the four guides.
*/

.page--article h1 {
  margin: 0;
}

/* Reading progress: a thin green line under the header. */
.art__progress {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  transform-origin: 0 50%;
  transform: scaleX(var(--read, 0));
  background: var(--c-green);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .art__progress {
    display: none;
  }
}

.art {
  padding: clamp(40px, 5vw, 72px) 0 clamp(72px, 8vw, 112px);
}

.art__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.art__head,
.art__body,
.art__foot {
  grid-column: 1 / 4;
  min-width: 0;
  padding: 0 var(--inset);
}

.art__rail {
  grid-column: 4 / 5;
  grid-row: 1 / span 3;
  position: sticky;
  top: 96px;
  min-width: 0;
  padding: 0 var(--inset);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 14.5px;
}

.crumbs a {
  color: var(--ink-2);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--c-green);
  text-decoration: underline;
}

.art__head {
  max-width: 820px;
}

.art__head h1 {
  font-size: clamp(32px, 3.6vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.art__lede {
  max-width: 36em;
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: clamp(17px, 1.35vw, 19.5px);
  line-height: 1.5;
}

.art__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 24px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.art__meta .sep {
  color: var(--ink-2);
}

/* The app pill: a tag in the app's own tint (chapter 10). */
.app-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-tag);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}

.app-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: currentColor;
}

.app-tag--it {
  background: var(--c-green-50);
  box-shadow: inset 0 0 0 1px var(--c-green-100);
  color: var(--c-green-800);
}

.app-tag--rr {
  background: var(--c-cobalt-50);
  box-shadow: inset 0 0 0 1px var(--c-cobalt-100);
  color: var(--c-cobalt-800);
}

.app-tag--md {
  background: var(--c-jade-50);
  box-shadow: inset 0 0 0 1px var(--c-jade-100);
  color: var(--c-jade-800);
}

.app-tag--all {
  background: var(--c-cloud);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
}

/* The reading column. */
.art__body {
  max-width: 720px;
  margin-top: clamp(36px, 4vw, 56px);
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--line);
  font-size: 17.5px;
  line-height: 1.65;
}

.art__body > :first-child {
  margin-top: 0;
}

.art__body p,
.art__body ul,
.art__body ol {
  margin: 0 0 1.1em;
}

/* Lists keep the guidelines' small square bullet (style.css); only the spacing is set here. */
.art__body ul {
  padding-left: 0;
}

.art__body ol {
  padding-left: 1.25em;
}

.art__body li {
  margin: 0 0 0.45em;
}

.art__body ol li::marker {
  color: var(--ink-4);
}

/* Navigation lists carry no bullet. */
.crumbs li,
.rail__toc li,
.rail__tools li,
.nlist li,
.rel__app li {
  margin-bottom: 0;
  padding-left: 0;
}

.crumbs li::before,
.rail__toc li::before,
.rail__tools li::before,
.nlist li::before,
.rel__app li::before {
  content: none;
}

.crumbs li + li::before {
  content: "/";
  position: static;
  width: auto;
  height: auto;
  margin-right: 8px;
  background: none;
  color: var(--ink-2);
}

.art__body h2 {
  margin: clamp(44px, 5vw, 64px) 0 14px;
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  scroll-margin-top: 96px;
}

.art__body h3 {
  margin: 32px 0 10px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  scroll-margin-top: 96px;
}

.art__body a {
  color: var(--c-green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.art__body a:hover {
  color: var(--c-green-700);
  text-decoration-thickness: 2px;
}

.art__body code {
  padding: 0.1em 0.35em;
  border-radius: var(--r-tag);
  background: var(--c-cloud);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--mono);
  font-size: 0.88em;
}

.art__body strong {
  font-weight: 600;
}

/* A figure: the real capture on a quiet panel, with a short caption. */
.art__fig {
  margin: 32px 0;
}

.art__fig > div {
  padding: clamp(12px, 2vw, 24px);
  border-radius: var(--r-l);
  background: var(--c-cloud);
  box-shadow: inset 0 0 0 1px var(--line);
}

.art__fig img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--r-s);
  box-shadow: 0 1px 2px rgba(16, 44, 54, 0.08), 0 0 0 1px var(--line);
}

.art__fig figcaption {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.5;
}

/* A chart of measured figures (Engineering articles): on white inside the panel, never smaller
   than its labels can be read, scrolling sideways on a phone like a wide table. */
.art__chart > div {
  overflow-x: auto;
  background: #fff;
}

.art__chart svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.art__chart > div:focus-visible {
  outline: 2px solid var(--c-green);
  outline-offset: 2px;
}

/* "In short": the release in four lines, before the detail. */
.art__short {
  margin: 0 0 32px;
  padding: 20px 24px;
  border-left: 3px solid var(--c-green);
  border-radius: 0 var(--r-m) var(--r-m) 0;
  background: var(--c-cloud);
}

.art__short p {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.art__short ul {
  margin: 0;
}

.art__short li:last-child {
  margin-bottom: 0;
}

/* The source line: where each fact can be checked. */
.art__source {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

/* Right rail. */
.rail__block + .rail__block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.rail__title {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail__toc {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.rail__toc a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
}

.rail__toc a:hover {
  color: var(--ink);
}

.rail__toc a[aria-current="true"] {
  border-left-color: var(--c-green);
  color: var(--ink);
  font-weight: 500;
}

.rail__tools {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail__tools li + li {
  margin-top: 2px;
}

.rail__tools a,
.rail__tools button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 14.5px;
  text-decoration: none;
  cursor: pointer;
}

.rail__tools a:hover,
.rail__tools button:hover {
  color: var(--c-green);
}

.rail__tools .ico {
  width: 16px;
  height: 16px;
  flex: none;
}

.rail__tools [data-done] {
  color: var(--c-green);
}

/* The app card: what the post is about, and where to try it. */
.appcard {
  padding: 18px;
  border-radius: var(--r-m);
  background: var(--c-white);
  box-shadow: inset 0 0 0 1px var(--line-lit);
}

.appcard__name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
}

.appcard__name svg {
  width: 32px;
  height: 32px;
  flex: none;
}

.appcard__tile {
  padding: 5px;
  border-radius: 8px;
  color: var(--c-white);
}

.appcard__tile--it {
  background: var(--c-green);
}

.appcard__tile--rr {
  background: var(--c-cobalt);
}

.appcard__tile--md {
  background: var(--c-jade-600);
}

.appcard p {
  margin: 10px 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.5;
}

.appcard .btn {
  width: 100%;
  justify-content: center;
}

.appcard__more {
  display: block;
  margin-top: 10px;
  color: var(--c-green);
  font-size: 14.5px;
  text-align: center;
}

/* Previous and next. */
.art__foot {
  max-width: 720px;
  margin-top: clamp(48px, 5vw, 72px);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pager a {
  display: block;
  padding: 18px 20px;
  border-radius: var(--r-m);
  box-shadow: inset 0 0 0 1px var(--line-lit);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow var(--t-1) var(--ease), background var(--t-1) var(--ease);
}

.pager a:hover {
  background: var(--c-cloud);
  box-shadow: inset 0 0 0 1px var(--c-green);
}

.pager small {
  display: block;
  color: var(--ink-2);
  font-size: 13.5px;
}

.pager b {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.pager time {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.pager .pager__next {
  grid-column: 2;
  text-align: right;
}

/* The news index: featured post, list, and every release. */
.nidx__head {
  max-width: 820px;
  padding: 0 var(--inset);
}

.nidx__head h1 {
  font-size: clamp(36px, 4.4vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.nidx__feeds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 24px 0 0;
  font-size: 15px;
}

.nidx__feeds a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.nidx__feeds a:hover {
  color: var(--c-green);
}

.feature {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature > a {
  grid-column: 1 / 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  padding: clamp(28px, 3vw, 40px) 0;
  color: var(--ink);
  text-decoration: none;
}

.feature__pic {
  grid-column: 1 / 3;
  padding: 0 var(--inset);
}

.feature__pic > div {
  padding: clamp(12px, 1.6vw, 20px);
  border-radius: var(--r-l);
  background: var(--c-jade-50);
  box-shadow: inset 0 0 0 1px var(--c-jade-100);
}

.feature__pic img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-s);
  box-shadow: 0 0 0 1px var(--line);
}

.feature__say {
  grid-column: 3 / 5;
  padding: 0 var(--inset);
}

.feature__say b {
  display: block;
  margin-top: 14px;
  font-size: clamp(24px, 2.3vw, 32px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  transition: color var(--t-1) var(--ease);
}

.feature > a:hover b {
  color: var(--c-green);
}

.feature__say p {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.5;
}

.nlist {
  margin: clamp(40px, 5vw, 64px) 0 0;
}

.nlist__head,
.rel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 0 var(--inset);
}

.nlist__head h2,
.rel__head h2 {
  margin: 0;
  font-size: clamp(24px, 2.3vw, 30px);
  letter-spacing: -0.03em;
}

.nlist__head p,
.rel__head p {
  max-width: 40em;
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
}

.nlist ol {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.nlist li {
  border-bottom: 1px solid var(--line);
}

.nlist a {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: baseline;
  padding: 18px 0;
  color: var(--ink);
  text-decoration: none;
}

.nlist a > * {
  padding: 0 var(--inset);
}

.nlist b {
  grid-column: 1 / 3;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  transition: color var(--t-1) var(--ease);
}

.nlist a:hover b {
  color: var(--c-green);
}

.nlist .app-tag {
  justify-self: start;
  margin-left: var(--inset);
  padding: 0 10px;
}

.nlist time {
  color: var(--ink-2);
  font-size: 14.5px;
  text-align: right;
}

.rel {
  margin-top: clamp(56px, 6vw, 88px);
}

.rel__apps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.rel__app {
  min-width: 0;
  padding: 0 var(--inset);
}

.rel__app h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  padding-top: 18px;
  border-top: 2px solid var(--c-ink);
  font-size: 16px;
  line-height: 1.3;
}

.rel__app--it h3 {
  border-top-color: var(--c-green);
}

.rel__app--rr h3 {
  border-top-color: var(--c-cobalt);
}

.rel__app--md h3 {
  border-top-color: var(--c-jade-600);
}

.rel__app > a {
  color: var(--c-green);
  font-size: 14.5px;
}

.rel__app ol {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.rel__app li {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr);
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.45;
}

.rel__app li span {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
}

.rel__app li time {
  grid-column: 2;
  color: var(--ink-2);
  font-size: 13.5px;
}

.rel__app li p {
  grid-column: 2;
  margin: 0;
}

.rel__app li a {
  color: var(--ink);
}

.rel__app li a:hover {
  color: var(--c-green);
}

/* Tablet: the rail moves under the body; the "On this page" list goes. */
@media (max-width: 1023px) {
  .art__head,
  .art__body,
  .art__foot,
  .art__rail {
    grid-column: 1 / 5;
  }

  .art__rail {
    position: static;
    grid-row: auto;
    max-width: 720px;
    margin-top: 40px;
  }

  .rail__block--toc {
    display: none;
  }

  .rail__block--toc + .rail__block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .rel__apps {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Phone. */
@media (max-width: 719px) {
  .art__body {
    font-size: 17px;
  }

  .feature > a {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .feature__pic,
  .feature__say {
    grid-column: 1;
  }

  .nlist a {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .nlist b {
    grid-column: 1 / 3;
  }

  .nlist time {
    text-align: right;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager .pager__next {
    grid-column: 1;
  }
}

/* ---------------------------------------------------------------------------
   Guides on the article layout (step 6). Their markup is kept as it was:
   section headings are h2.label, text sits in .prose, and components
   (tables, calculators, step lists) keep the guide stylesheet. These rules
   only fit them to the reading column.
   --------------------------------------------------------------------------- */
.art--guide .art__head .crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.art--guide .art__head .crumbs li {
  margin: 0;
  padding: 0;
}

.art--guide .art__head .crumbs li::before {
  content: none;
}

.art--guide .art__head .crumbs li + li::before {
  content: "/";
  position: static;
  width: auto;
  height: auto;
  margin-right: 8px;
  background: none;
  color: var(--ink-2);
}

.art--guide .art__head h1 {
  max-width: 22em;
}

.art--guide .art__head .lede {
  max-width: 36em;
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: clamp(17px, 1.35vw, 19.5px);
  line-height: 1.5;
}

.art--guide .art__head .byline,
.art--guide .art__head .meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.art--guide .art__head .meta-line {
  margin-top: 8px;
}

.art--guide .art__head .byline strong {
  color: var(--ink);
  font-weight: 600;
}

.art--guide .art__body {
  max-width: 760px;
}

.art--guide .art__body > .label {
  max-width: none;
  margin: clamp(44px, 5vw, 64px) 0 14px;
  padding-top: 0;
  border-top: 0;
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  scroll-margin-top: 96px;
}

.art--guide .art__body > .label:first-child {
  margin-top: 0;
}

.art--guide .art__body .prose {
  max-width: none;
  font-size: inherit;
  line-height: inherit;
}

.art--guide .art__body .table-scroll {
  max-width: 100%;
}

.art--guide .art__body img {
  max-width: 100%;
  height: auto;
}

.art--guide .rail__toc li + li {
  margin-top: 0;
}

/* Buttons keep their own colors inside the body and the rail. */
.art__body a.btn,
.art__rail a.btn,
.art__body a.btn:hover,
.art__rail a.btn:hover {
  color: var(--ground);
  text-decoration: none;
}

.art__body a.btn--ghost,
.art__body a.btn--ghost:hover {
  color: var(--ink);
}

/* The same in the page head (the /support buttons) and for a second button in the rail. */
.art__head a.btn,
.art__head a.btn:hover {
  color: var(--ground);
  text-decoration: none;
}

.art__head a.btn--ghost,
.art__head a.btn--ghost:hover,
.art__rail a.btn--ghost,
.art__rail a.btn--ghost:hover {
  color: var(--ink);
}

.art__head .actions {
  margin: 20px 0 4px;
}

.appcard .btn + .btn {
  margin-top: 8px;
}

/* The rail never grows past the screen (Rolf, 19 Nov: on long guides the
   lower part only showed at the end of the page). The tools and the app card
   stay in view; only "On this page" scrolls, inside itself. */
@media (min-width: 1024px) {
  .art__rail {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 184px);
  }

  .art__rail > .rail__block {
    flex: none;
  }

  .art__rail > .rail__block--toc {
    flex: 0 1 auto;
    min-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(180deg, #000 calc(100% - 24px), transparent);
    padding-bottom: 16px;
  }

  .art__rail .rail__toc a {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 14px;
  }

  .art__rail .rail__block + .rail__block {
    margin-top: 20px;
    padding-top: 18px;
  }

  .art__rail .appcard {
    padding: 16px;
  }

  .art__rail .appcard p {
    margin: 8px 0 12px;
    font-size: 14px;
  }
}

@media (min-width: 1024px) and (max-height: 760px) {
  .art__rail .appcard > p:not(.appcard__name) {
    display: none;
  }
}

/* Plain opening paragraphs in a heading block read as the lede (support, regulated clouds). */
.art--guide .art__head > p:not(.byline):not(.meta-line):not(.lede) {
  max-width: 38em;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: clamp(16.5px, 1.3vw, 18.5px);
  line-height: 1.55;
}
