/* Methodology page in the navy look (same style as the home page and the other restyled pages). Loaded last on
   methodology.html. Every rule is scoped to html:not(.kdc-classic), so the classic look is untouched. The page body
   carries data-styled, which turns off site-chrome.js's automatic colour pass, so every colour on this page comes from
   here. #main is in the selectors so these rules outrank the page's own styles, readability.css and navy-site.css;
   !important is only used against inline styles and their !important rules. */

/* Page: the header's side padding, light body text. */
html:not(.kdc-classic) body.page-methodology #main { max-width: none; width: 100%; margin: 0; padding: 22px var(--kdc-pad) 32px; color: #d4dde8 !important; }

/* Reading column: the content is a one-column grid (max 880px) at every width, so the spacing is the same on phones
   and desktops (grid items' margins never collapse). On wide screens the contents list becomes a second column
   (see the min-width: 1200px block at the end). */
html:not(.kdc-classic) body.page-methodology #main .container { display: grid; grid-template-columns: minmax(0, 880px); align-items: start;
  max-width: none !important; margin: 0 !important; padding: 0 !important; }
html:not(.kdc-classic) body.page-methodology #main .container > * { min-width: 0; }

/* Title block: quiet mono eyebrow (was green), 28px white title, intro in the body colour. */
html:not(.kdc-classic) body.page-methodology #main .page-eyebrow { font: 500 11px/1.3 'IBM Plex Mono', monospace !important; letter-spacing: 0.08em; text-transform: uppercase; color: #8fa1b7 !important; margin: 0 0 6px; }
html:not(.kdc-classic) body.page-methodology #main .page-title { font: 800 28px/1.15 'Inter', sans-serif !important; letter-spacing: -0.02em !important; color: #fff !important; margin: 0 0 10px !important; padding: 0; border: 0; }

/* Headings: white Inter, no red rule under the section titles (red is kept for the debt figure); about 34px above a
   section title, 22px above a sub-heading. scroll-margin keeps a heading clear of the sticky site header when a
   contents link jumps to it. */
html:not(.kdc-classic) body.page-methodology #main h2 { font: 800 20px/1.3 'Inter', sans-serif !important; letter-spacing: -0.015em; color: #fff !important;
  margin: 20px 0 10px; padding: 0; border: 0 !important; scroll-margin-top: 120px; }
html:not(.kdc-classic) body.page-methodology #main h3 { font: 700 16px/1.35 'Inter', sans-serif !important; color: #fff !important; margin: 8px 0 8px; scroll-margin-top: 120px; }

/* Body text: 15px, line-height 1.65, light grey; bold words white. The lists carry inline dark colours, sizes and
   margins, hence !important. */
html:not(.kdc-classic) body.page-methodology #main :is(p, li) { font-size: 15px !important; line-height: 1.65 !important; color: #d4dde8 !important; }
html:not(.kdc-classic) body.page-methodology #main p { margin: 0 0 14px; }
html:not(.kdc-classic) body.page-methodology #main .container > :is(ol, ul) { margin: 0 0 14px !important; padding-left: 22px; }
html:not(.kdc-classic) body.page-methodology #main li { margin: 0 0 4px; }
html:not(.kdc-classic) body.page-methodology #main li > ul { margin: 6px 0 2px !important; padding-left: 20px; }
html:not(.kdc-classic) body.page-methodology #main li::marker { color: #8fa1b7; }
html:not(.kdc-classic) body.page-methodology #main :is(strong, b) { color: #fff; }
html:not(.kdc-classic) body.page-methodology #main em { color: inherit; }
/* The small-print note under the history table (inline 0.85rem). */
html:not(.kdc-classic) body.page-methodology #main p[style*="font-size"] { font-size: 12.5px !important; line-height: 1.6 !important; color: #8fa1b7 !important; }

/* Links: light blue, underline only on hover. */
html:not(.kdc-classic) body.page-methodology #main a { color: #7cc4ff !important; text-decoration: none; }
html:not(.kdc-classic) body.page-methodology #main a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Contents list: a compact panel under the intro (on wide screens it becomes the sticky left column, below). */
html:not(.kdc-classic) body.page-methodology #main .method-toc { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 16px; padding: 14px 18px;
  background: rgba(19, 38, 61, 0.65) !important; border: 0 !important; border-radius: 12px; box-shadow: none !important; }
html:not(.kdc-classic) body.page-methodology #main .method-toc strong { flex-basis: 100%; margin: 0 0 4px; font: 500 11px/1.3 'IBM Plex Mono', monospace !important; letter-spacing: 0.08em; text-transform: uppercase; color: #8fa1b7 !important; }
html:not(.kdc-classic) body.page-methodology #main .method-toc a { font-size: 13.5px !important; line-height: 1.4; padding: 3px 0; }

/* Callouts (.note): one quiet panel, no outline and no coloured left edge (was amber or green). */
html:not(.kdc-classic) body.page-methodology #main .note { margin: 0 0 14px; padding: 14px 18px; background: rgba(19, 38, 61, 0.65) !important; border: 0 !important;
  border-radius: 12px; box-shadow: none !important; font-size: 14.5px !important; line-height: 1.65; color: #d4dde8 !important; }
html:not(.kdc-classic) body.page-methodology #main .note :is(li) { font-size: 14.5px !important; }
html:not(.kdc-classic) body.page-methodology #main .note ul { margin: 8px 0 8px !important; padding-left: 20px; }

/* Formula boxes (several are filled by the page script after load): the same panel, IBM Plex Mono 13px, comments
   muted, totals in bold white. Long lines wrap so nothing scrolls sideways on phones. */
html:not(.kdc-classic) body.page-methodology #main .formula-box { margin: 0 0 14px; padding: 16px 18px; background: rgba(19, 38, 61, 0.65) !important; border: 0 !important;
  border-radius: 12px; box-shadow: none !important; font: 400 13px/1.7 'IBM Plex Mono', monospace !important; color: #d4dde8 !important;
  overflow-wrap: anywhere; overflow-x: visible; }
/* site-fonts.css forces its font on every element with !important, so the comment and bold spans inside need the
   mono font set on them too. */
html:not(.kdc-classic) body.page-methodology #main .formula-box * { font-family: 'IBM Plex Mono', monospace !important; }
html:not(.kdc-classic) body.page-methodology #main .formula-box .comment { color: #8fa1b7 !important; }
html:not(.kdc-classic) body.page-methodology #main .formula-box strong { color: #fff !important; font-weight: 600; }

/* Tables, one style site-wide. The tables have no wrapper, so the table itself is the panel: a block that scrolls
   sideways when its rows are wider than the column (only on small screens), with the rows laid out as a table inside. */
html:not(.kdc-classic) body.page-methodology #main .source-table { display: block; width: 100%; margin: 0 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: rgba(19, 38, 61, 0.65) !important; border: 0 !important; border-radius: 12px; box-shadow: none !important;
  scrollbar-color: rgba(150, 205, 255, 0.35) transparent; }   /* the panel's own scrollbar in the palette */
html:not(.kdc-classic) body.page-methodology #main .source-table > tbody { display: table; width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
html:not(.kdc-classic) body.page-methodology #main .source-table tr { background: transparent !important; }   /* also clears the deficit row's inline pink */
html:not(.kdc-classic) body.page-methodology #main .source-table th { background: #182f4a !important; color: #8fa1b7 !important; border: 0 !important; border-bottom: 1px solid #243950 !important;
  font: 500 11px/1.35 'IBM Plex Mono', monospace !important; letter-spacing: 0.06em !important; text-transform: uppercase !important;   /* readability.css sets none !important */
  padding: 10px 10px !important; text-align: left; vertical-align: bottom; }
html:not(.kdc-classic) body.page-methodology #main .source-table td { background: transparent !important; color: #d4dde8 !important; border: 0 !important; border-bottom: 1px solid #243950 !important;
  font-size: 13.5px !important; line-height: 1.5; padding: 9px 10px !important; vertical-align: top; text-align: left; }
html:not(.kdc-classic) body.page-methodology #main .source-table tr:last-child td { border-bottom: 0 !important; }
html:not(.kdc-classic) body.page-methodology #main .source-table tr:hover td { background: rgba(124, 196, 255, 0.06) !important; }   /* no zebra stripes, a quiet hover */
html:not(.kdc-classic) body.page-methodology #main .source-table td strong { color: #fff; }
/* The deficit row in the budget table (inline bold on a light pink row): bold white on navy. */
html:not(.kdc-classic) body.page-methodology #main .source-table tr[style] td { color: #fff !important; font-weight: 600; }

/* Figures right-aligned. The tables have no ids, so they are picked by their order on the page: 6 = debt history
   (debt and debt/GDP), 7 = budget components (amount), 8 = borrowing per period (amount). */
html:not(.kdc-classic) body.page-methodology #main table.source-table:nth-of-type(6) :is(th, td):is(:nth-child(2), :nth-child(3)),
html:not(.kdc-classic) body.page-methodology #main table.source-table:is(:nth-of-type(7), :nth-of-type(8)) :is(th, td):nth-child(2) { text-align: right; white-space: nowrap; }
html:not(.kdc-classic) body.page-methodology #main table.source-table:nth-of-type(6) td:first-child { color: #fff !important; font-weight: 600; }
html:not(.kdc-classic) body.page-methodology #main table.source-table:nth-of-type(6) td:nth-child(2) { color: #fff !important; }

/* Source-type badges: small quiet mono pills (were green, blue or orange). */
html:not(.kdc-classic) body.page-methodology #main .badge { display: inline-block; padding: 2px 7px; border-radius: 999px; background: transparent !important; color: #8fa1b7 !important;
  box-shadow: inset 0 0 0 1px #33465c; font: 500 10.5px/1.4 'IBM Plex Mono', monospace !important; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }

/* Back link at the end: a quiet pill button (was a light block that turned red on hover). */
html:not(.kdc-classic) body.page-methodology #main .back-link { justify-self: start; margin: 18px 0 0; padding: 9px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: inset 0 0 0 1px rgba(150, 205, 255, 0.35); color: #7cc4ff !important; font-size: 14px; font-weight: 600; text-decoration: none; }
html:not(.kdc-classic) body.page-methodology #main .back-link:hover { background: rgba(124, 196, 255, 0.12) !important; color: #fff !important; text-decoration: none; }

/* Hover tips (tooltips.js) in the navy palette instead of near-black. */
html:not(.kdc-classic) .kdc-tip { background: #07111d; color: #d4dde8; box-shadow: inset 0 0 0 1px rgba(150, 205, 255, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.9); }
html:not(.kdc-classic) .kdc-tip::after { border-bottom-color: #07111d; }
html:not(.kdc-classic) body.page-methodology :focus-visible { outline: 2px solid #7cc4ff; outline-offset: 2px; }

/* Wide windows: the contents list becomes a sticky left column beside the reading column. It spans every row of the
   grid (the page has about 110 blocks; 300 leaves room) so it can stay in view to the end, sitting just under the site
   header (12px frame + 38px ticker + 52px header = 102px) and scrolling inside itself if the window is short. */
@media (min-width: 1200px) {
  html:not(.kdc-classic) body.page-methodology #main .container { grid-template-columns: 220px minmax(0, 880px); column-gap: 48px; }
  html:not(.kdc-classic) body.page-methodology #main .container > * { grid-column: 2; }
  html:not(.kdc-classic) body.page-methodology #main .container > .method-toc { grid-column: 1; grid-row: 1 / span 300; position: sticky; top: 118px;
    flex-direction: column; flex-wrap: nowrap; gap: 0; margin: 4px 0 0; padding: 14px 16px; max-height: calc(100vh - 200px); overflow-y: auto; scrollbar-width: thin;
    scrollbar-color: rgba(150, 205, 255, 0.35) transparent; }
  html:not(.kdc-classic) body.page-methodology #main .method-toc strong { flex-basis: auto; margin: 0 0 6px; }
  html:not(.kdc-classic) body.page-methodology #main .method-toc a { font-size: 13px !important; line-height: 1.4; padding: 5px 0; }
}

/* Phones: slightly smaller text; wide tables (three or more columns) keep a readable width and scroll sideways inside
   their panel only, never the page. */
@media (max-width: 600px) {
  html:not(.kdc-classic) body.page-methodology #main { padding: 16px var(--kdc-pad) 24px; }
  html:not(.kdc-classic) body.page-methodology #main .page-title { font-size: 26px !important; }
  html:not(.kdc-classic) body.page-methodology #main h2 { font-size: 18px !important; }
  html:not(.kdc-classic) body.page-methodology #main :is(p, li) { font-size: 14.5px !important; }
  html:not(.kdc-classic) body.page-methodology #main :is(.note, .formula-box) { padding: 14px; }
  html:not(.kdc-classic) body.page-methodology #main .formula-box { font-size: 12.5px !important; }
  html:not(.kdc-classic) body.page-methodology #main .source-table:has(th:nth-child(3)) > tbody { min-width: 600px; }
  html:not(.kdc-classic) body.page-methodology #main .source-table th { padding: 9px 8px !important; }
  html:not(.kdc-classic) body.page-methodology #main .source-table td { padding: 8px !important; font-size: 13px !important; }
}
