/* Guide article v2 (design audit round 5 item A, 2026-11-30). Loaded by the guide ARTICLE pages only (_redesign/build-guides.py,
   GUIDE_CSS_LINK), after the theme sheet. The base guide styles stay in css/dn-theme-2026-pages.css and css/dn-site-2026.css.

   What this adds: a side column of three cards that follows the reader (adviser, calculators, related guides), "On this page"
   inside the Key points box, and one 760px text width from the title to the last line (the related guides were a 1,216px band). */

/* a heading reached from "On this page" clears the fixed header */
.dn-guide-v2 :is(.dn-guide-sec, .dn-guide-faq, .dn-guide-links) { scroll-margin-top: 96px; }

/* "On this page", under the key points in the same box */
html[data-theme] .dn-guide-v2 .dn-guide-toc { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border-subtle); }
html[data-theme] .dn-guide-v2 .dn-guide-toc h2 { margin: 0 0 10px !important; font-size: 16px !important; font-weight: 600 !important; color: var(--color-text-primary) !important; }
html[data-theme] .dn-guide-v2 .dn-guide-toc ol { margin: 0 !important; padding-inline-start: 20px !important; columns: 2; column-gap: 32px; }
html[data-theme] .dn-guide-v2 .dn-guide-toc li { margin: 0 0 6px !important; font-size: 14px !important; line-height: 1.5 !important; color: var(--color-text-secondary) !important; break-inside: avoid; }
html[data-theme] .dn-guide-v2 .dn-guide-toc a { font-weight: 500 !important; color: var(--color-text-primary) !important; text-decoration: underline !important; text-decoration-color: var(--color-border-strong) !important; text-underline-offset: 3px; }
html[data-theme] .dn-guide-v2 .dn-guide-toc a:hover { text-decoration-color: currentColor !important; }
@media (max-width: 560px) { html[data-theme] .dn-guide-v2 .dn-guide-toc ol { columns: 1; } }

/* the side column: three cards */
html[data-theme] .dn-guide-v2 > .dn-guide-aside { display: grid; gap: 16px; margin: 40px 0 0; max-width: var(--dn-read, 760px); }
html[data-theme] .dn-guide-v2 > .dn-guide-aside > section { display: block; margin: 0 !important; padding: 20px; box-sizing: border-box; border: 1px solid var(--color-border); border-radius: var(--radius-card, 16px); background: var(--color-background); }
html[data-theme] .dn-guide-v2 > .dn-guide-aside > section > h2,
html[data-theme] .dn-guide-v2 > .dn-guide-aside > .dn-guide-cta h2 { margin: 0 0 8px !important; font-size: 16px !important; line-height: 1.4 !important; font-weight: 600 !important; color: var(--color-text-primary) !important; }
html[data-theme] .dn-guide-v2 > .dn-guide-aside > .dn-guide-cta p { max-width: none; }
html[data-theme] .dn-guide-v2 > .dn-guide-aside > .dn-guide-cta .dn-guide-cta-acts { margin-top: 14px; }
html[data-theme] .dn-guide-v2 > .dn-guide-aside ul { list-style: none; margin: 0 !important; padding: 0 !important; }
/* calculators: plain rows */
html[data-theme] .dn-guide-v2 .dn-guide-tools li + li { border-top: 1px solid var(--color-border-subtle); }
html[data-theme] .dn-guide-v2 .dn-guide-tools a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 4px 0; font-size: 14px; font-weight: 500;
  color: var(--color-text-primary) !important; text-decoration: none !important; }
html[data-theme] .dn-guide-v2 .dn-guide-tools a::after { content: "\203A"; color: var(--color-text-muted); font-size: 16px; }
html[dir="rtl"][data-theme] .dn-guide-v2 .dn-guide-tools a::after { content: "\2039"; }
html[data-theme] .dn-guide-v2 .dn-guide-tools a:hover { text-decoration: underline !important; text-underline-offset: 3px; }
/* related guides: picture, title, reading time */
html[data-theme] .dn-guide-v2 .dn-guide-rel ul { display: grid; gap: 12px; }
html[data-theme] .dn-guide-v2 .dn-guide-rel a { display: flex; align-items: center; gap: 12px; color: var(--color-text-primary) !important; text-decoration: none !important; }
html[data-theme] .dn-guide-v2 .dn-guide-rel img { flex: 0 0 88px; width: 88px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--color-surface-secondary); }
html[data-theme] .dn-guide-v2 .dn-guide-rel span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
html[data-theme] .dn-guide-v2 .dn-guide-rel b { font-size: 14px; line-height: 1.4; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html[data-theme] .dn-guide-v2 .dn-guide-rel small { font-size: 12px; color: var(--color-text-muted); }
html[data-theme] .dn-guide-v2 .dn-guide-rel a:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* the last line keeps the text width at every size (it ran the whole frame) */
html[data-theme] .dn-guide-v2 > .dn-guide-disclaimer { max-width: var(--dn-read, 760px); }

/* 1200px and up: the column sits beside the article and stays in view for the whole read */
@media (min-width: 1200px) {
  html body main.dn-guide-shell > .dn-guide-wrap.dn-guide-v2:not(.dn-guide-hub) > .dn-guide-aside {
    grid-column: 2; grid-row: 2; justify-self: end; width: 100%; max-width: 400px; margin: 0;
    position: sticky; top: 96px; align-self: start;
    /* a short screen: the column scrolls inside itself instead of hiding its last card */
    max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  }
  /* the last line keeps the text width (it ran the full 1,216px) */
  html body main.dn-guide-shell > .dn-guide-wrap.dn-guide-v2:not(.dn-guide-hub) > .dn-guide-disclaimer { grid-column: 1; }
}
/* between a phone and the two-column layout: the cards stay inside the 760px text width - adviser and calculators side by side,
   the related guides under them */
@media (min-width: 700px) and (max-width: 1199.98px) {
  html[data-theme] .dn-guide-v2 > .dn-guide-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  html[data-theme] .dn-guide-v2 > .dn-guide-aside > .dn-guide-rel { grid-column: 1 / -1; }
  html[data-theme] .dn-guide-v2 .dn-guide-rel ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* the golden-visa guide's "Ask us" box (js/dn-portal-shell-v2.js adds it after the article): the text width, on the article's own
   edge - it was the one block left at the full frame */
@media (min-width: 761px) {
  html body main.dn-guide-shell:has(> .dn-guide-wrap.dn-guide-v2) > .dn-enq-page-cta {
    width: min(var(--dn-read, 760px), 100% - 2 * var(--dn-gutter, 32px)); max-width: none !important;
    margin-inline-start: calc((100% - min(var(--dn-frame-in, 1216px), 100% - 2 * var(--dn-gutter, 32px))) / 2) !important; margin-inline-end: auto !important;
  }
}
