/* Before You Bid Scotland: shared styles for the guides, legal and thank-you pages.
   Same tokens as the homepage: cream ground, forest ink, caramel and rust accents. */
:root {
  --sand: #f5f4f0; --sand-light: #ffffff; --stone: #d4a27f; --stone-soft: #efe3d6; --umber: #8a3a22;
  --ink: #1e2b33; --ink-muted: #4d5a63; --rule: #e0dcd5; --rust: #a9472a;
  --slate: #1e2b33; --on-slate: #f5f4f0; --slate-hover: #33505e;
  --moss: #2f6b4f; --rose: #9b2f2f; --focus: #1f5fd1; --foot: #162027;
  --shadow-soft: 0 1px 2px rgba(30, 43, 51, 0.08), 0 14px 34px rgba(51, 80, 94, 0.16);
  --font-display: Literata, Georgia, "Times New Roman", serif;
  --font-sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --space-12: 48px; --space-16: 64px; --space-24: 96px;
  --radius-s: 8px; --radius-m: 10px; --radius-l: 14px; --radius-full: 999px;
  --page-max: 1160px; --measure: 700px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sand: #11181d; --sand-light: #1a242b; --stone: #d4a27f; --stone-soft: #4a3326; --umber: #d4a27f;
    --ink: #edf0f2; --ink-muted: #b8c2c9; --rule: #2b3841; --rust: #d4a27f;
    --slate: #d4a27f; --on-slate: #11181d; --slate-hover: #e2b496;
    --moss: #8fd1b0; --rose: #f08f8f; --focus: #8ab4ff; --foot: #0c1216;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sand: #11181d; --sand-light: #1a242b; --stone: #d4a27f; --stone-soft: #4a3326; --umber: #d4a27f;
  --ink: #edf0f2; --ink-muted: #b8c2c9; --rule: #2b3841; --rust: #d4a27f;
  --slate: #d4a27f; --on-slate: #11181d; --slate-hover: #e2b496;
  --moss: #8fd1b0; --rose: #f08f8f; --focus: #8ab4ff; --foot: #0c1216;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--sand); color: var(--ink); font-family: var(--font-sans); font-size: 18px; line-height: 29px; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--rust); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--radius-s); }
[hidden] { display: none !important; }
.wrap { max-width: calc(var(--page-max) + 2 * var(--space-6)); margin: 0 auto; padding-left: max(var(--space-6), env(safe-area-inset-left, 0px)); padding-right: max(var(--space-6), env(safe-area-inset-right, 0px)); }
@media (max-width: 520px) { .wrap { padding-left: max(var(--space-4), env(safe-area-inset-left, 0px)); padding-right: max(var(--space-4), env(safe-area-inset-right, 0px)); } }

/* Header (same as the homepage) */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: var(--sand); box-shadow: 0 1px 0 var(--rule); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 51; background: var(--sand); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding-block: var(--space-4); }
.wordmark { display: inline-flex; align-items: baseline; gap: var(--space-2); text-decoration: none; color: var(--ink); white-space: nowrap; }
.wordmark-name { font-family: var(--font-display); font-weight: 700; font-size: 23px; line-height: 1; letter-spacing: -0.01em; }
.wordmark-name em { font-style: normal; background: var(--stone-soft); border-radius: 6px; padding: 0 5px; }
.wordmark-place { font-size: 15px; line-height: 1; color: var(--ink-muted); }
.site-nav { display: flex; align-items: center; gap: var(--space-6); }
.site-nav > a:not(.btn), .site-nav summary { font-size: 17px; text-decoration: none; cursor: pointer; color: var(--ink); }
.site-nav > a:not(.btn):hover, .site-nav summary:hover { text-decoration: underline; text-decoration-color: var(--rust); text-underline-offset: 5px; text-decoration-thickness: 2px; }
.guides-menu { position: relative; }
.guides-menu summary { list-style: none; }
.guides-menu summary::-webkit-details-marker { display: none; }
.guides-menu summary::after { content: " \25BE"; color: var(--ink-muted); }
.guides-panel { position: absolute; right: 0; top: calc(100% + var(--space-3)); width: min(760px, calc(100vw - 32px)); max-height: 75vh; overflow-y: auto; background: var(--sand-light); border-radius: var(--radius-m); box-shadow: var(--shadow-soft); padding: var(--space-6); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); }
.menu-group { display: grid; align-content: start; }
.menu-head { margin: 0 0 var(--space-1); font-size: 13px; line-height: 18px; font-weight: 700; letter-spacing: 0.04em; color: var(--umber); padding-bottom: var(--space-2); border-bottom: 2px solid var(--rule); }
.guides-panel a { display: block; padding: 6px 0; font-size: 15px; line-height: 21px; text-decoration: none; color: var(--ink); }
.guides-panel a:hover { text-decoration: underline; text-decoration-color: var(--rust); text-underline-offset: 3px; }
.guides-panel .menu-all { grid-column: 1 / -1; font-weight: 700; border-top: 1px solid var(--rule); padding-top: var(--space-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font-family: var(--font-sans); font-size: 17px; line-height: 22px; font-weight: 700; padding: 15px 26px; border-radius: 10px; border: 0; text-decoration: none; cursor: pointer; transition: background-color 150ms, transform 150ms; }
.btn-primary { background: var(--slate); color: var(--on-slate); }
.btn-primary:hover { background: var(--slate-hover); transform: translateY(-1px); color: var(--on-slate); }
.btn-rust { background: var(--rust); color: #f5f4f0; font-size: 19px; }
.btn-rust:hover { background: var(--umber); color: #f5f4f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-rust, :root:not([data-theme="light"]) .btn-rust:hover { color: #11181d; } }
:root[data-theme="dark"] .btn-rust, :root[data-theme="dark"] .btn-rust:hover { color: #11181d; }
@media (max-width: 760px) {
  .site-nav .hide-sm { display: none; }
  .site-nav { gap: var(--space-4); }
  .site-nav .btn { padding: 10px 16px; font-size: 15px; }
  .wordmark-place { display: none; }
  .guides-panel { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); right: -96px; }
}
@media (max-width: 520px) { .site-nav .btn { display: none; } .guides-panel { right: -8px; } }

/* Footer (same as the homepage) */
.site-footer { margin-top: var(--space-24); background: var(--foot); color: #f5f4f0; padding-block: var(--space-12) var(--space-16); }
.site-footer a { color: #f5f4f0; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-decoration-color: #d4a27f; text-underline-offset: 4px; }
.site-footer .wordmark-name { font-size: 34px; }
.site-footer .wordmark-name em { background: #a9472a; }
.site-footer .wordmark-place, .site-footer .foot-note { color: #d4a27f; }
.foot-note { font-size: 15px; line-height: 23px; margin: var(--space-4) 0 0; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); align-items: end; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-6); font-size: 16px; }
.footer-mail { font-size: 16px; margin: var(--space-4) 0 0; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }

/* Page body */
main.wrap { padding-top: var(--space-8); }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: 15px; line-height: 22px; color: var(--ink-muted); margin-bottom: var(--space-8); }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.eyebrow { display: inline-block; font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink); background: var(--stone-soft); border-radius: var(--radius-full); padding: 3px 14px; margin-bottom: var(--space-4); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; color: var(--ink); }
h1 { font-size: 50px; line-height: 58px; margin: 0 0 var(--space-6); max-width: 900px; }
.lede { font-size: 21px; line-height: 33px; max-width: var(--measure); margin: 0 0 var(--space-6); }
@media (max-width: 720px) { h1 { font-size: 36px; line-height: 43px; } .lede { font-size: 19px; line-height: 30px; } }

/* Articles (guides) and documents (privacy, terms) */
.article, .doc { max-width: var(--measure); }
.article { margin: 0 auto 0 0; }
.article h2, .doc h2 { font-size: 30px; line-height: 38px; margin: var(--space-12) 0 var(--space-4); }
.article h3, .doc h3 { font-size: 22px; line-height: 30px; margin: var(--space-8) 0 var(--space-3); }
.article p, .doc p { margin: 0 0 var(--space-4); }
.article ul, .article ol, .doc ul, .doc ol { margin: 0 0 var(--space-4); padding-left: 26px; display: grid; gap: var(--space-2); }
.article li::marker, .doc li::marker { color: var(--rust); }
.article strong, .doc strong { font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); font-size: 15px; line-height: 22px; color: var(--ink-muted); margin-bottom: var(--space-8); }
.meta span + span::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--stone); margin: 0 var(--space-3) 3px calc(-1 * var(--space-3)); }
.updated { font-size: 15px; color: var(--ink-muted); }
.answer { background: var(--sand-light); border-radius: var(--radius-l); box-shadow: var(--shadow-soft); padding: var(--space-6) var(--space-8); margin: 0 0 var(--space-8); }
.answer-label { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--umber); margin-bottom: var(--space-2); }
.answer p:last-child { margin-bottom: 0; }
.callout { background: var(--stone-soft); border-radius: var(--radius-m); padding: var(--space-4) var(--space-6); margin: 0 0 var(--space-6); }
.note { font-size: 15px; line-height: 23px; color: var(--ink-muted); }
.inline-cta { background: var(--stone-soft); border-radius: var(--radius-m); padding: var(--space-4) var(--space-6); font-size: 17px; line-height: 26px; }
.inline-cta a { font-weight: 700; }
.tbl-wrap { overflow-x: auto; margin: 0 0 var(--space-4); background: var(--sand-light); border-radius: var(--radius-m); padding: var(--space-2) var(--space-6); }
table { width: 100%; border-collapse: collapse; font-size: 17px; line-height: 24px; }
th { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink-muted); text-align: left; padding: var(--space-3) 0 var(--space-2); border-bottom: 2px solid var(--rule); }
td { padding: var(--space-3) 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td + td, th + th { padding-left: var(--space-6); }
.num { font-variant-numeric: tabular-nums lining-nums; text-align: right; white-space: nowrap; }
@media (max-width: 560px) { .num { white-space: normal; } .answer { padding: var(--space-4) var(--space-6); } }

/* FAQ */
.faq h2 { margin-bottom: var(--space-6); }
.faq-list { display: grid; gap: var(--space-3); }
.faq-item { background: var(--sand-light); border-radius: var(--radius-m); }
.faq-item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-6); font-size: 18px; line-height: 26px; font-weight: 700; border-radius: var(--radius-m); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex: none; width: 30px; height: 30px; border-radius: var(--radius-full); background: var(--stone-soft); display: grid; place-items: center; font-weight: 400; font-size: 20px; line-height: 1; transition: transform 200ms; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 var(--space-6) var(--space-4); margin: 0; }

/* Call to action at the end of a guide */
.cta-box { margin: var(--space-12) 0; background: var(--slate); color: var(--on-slate); border-radius: var(--radius-l); padding: var(--space-8) var(--space-8) var(--space-6); display: grid; gap: var(--space-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cta-box { background: var(--sand-light); color: var(--ink); } }
:root[data-theme="dark"] .cta-box { background: var(--sand-light); color: var(--ink); }
.cta-box h2 { margin: 0; color: inherit; font-size: 30px; line-height: 38px; }
.cta-box p { margin: 0; color: inherit; opacity: 0.92; }
.cta-eyebrow { justify-self: start; font-size: 14px; font-weight: 700; color: #1e2b33; background: #d4a27f; border-radius: var(--radius-full); padding: 3px 14px; }
.cta-btn { justify-self: start; margin-top: var(--space-2); display: inline-flex; align-items: center; font-weight: 700; font-size: 19px; line-height: 22px; padding: 15px 26px; border-radius: 10px; background: #a9472a; color: #f5f4f0; text-decoration: none; transition: background-color 150ms, transform 150ms; }
.cta-btn:hover { background: #8a3a22; color: #f5f4f0; transform: translateY(-1px); }
.cta-assure { list-style: none; padding: 0 !important; margin: 0 !important; display: flex !important; flex-wrap: wrap; gap: var(--space-1) var(--space-6) !important; font-size: 15px; opacity: 0.9; }
.cta-assure li { display: inline-flex; align-items: center; gap: var(--space-2); }
.cta-assure li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d4a27f; }
@media (max-width: 560px) { .cta-box { padding: var(--space-6); } }

/* Sources and related guides */
.sources { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--rule); font-size: 16px; line-height: 25px; }
.sources h2 { font-size: 22px; line-height: 30px; margin: 0 0 var(--space-3); }
.related { margin-top: var(--space-12); }
.related h2 { margin-top: 0; }
.guide-list { display: grid; gap: var(--space-3); }
.guide-card { display: grid; gap: var(--space-2); background: var(--sand-light); border-radius: var(--radius-m); padding: var(--space-6); text-decoration: none; color: var(--ink); transition: transform 200ms ease-out, box-shadow 200ms; }
.guide-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.guide-card h2, .guide-card h3 { margin: 0 !important; font-size: 21px !important; line-height: 28px !important; }
.guide-card p { margin: 0 !important; font-size: 16px; line-height: 24px; color: var(--ink-muted); }
.guide-meta { font-size: 14px; color: var(--ink-muted); }

/* Guides index */
.guides-home .lede { margin-bottom: var(--space-12); }
.guide-groups { display: grid; gap: var(--space-12); }
.guide-group .group-h { font-size: 30px; line-height: 38px; margin: 0 0 var(--space-2); }
.group-blurb { margin: 0 0 var(--space-6); color: var(--ink-muted); }
.guide-group .guide-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--space-4); }
.guide-group .guide-card { align-content: start; }

/* Calculators */
.calc { background: var(--sand-light); border-radius: var(--radius-l); box-shadow: var(--shadow-soft); padding: var(--space-8); margin: 0 0 var(--space-8); display: grid; gap: var(--space-6); }
.calc-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-4) var(--space-6); }
.calc-fields label { display: block; font-size: 16px; font-weight: 700; margin-bottom: var(--space-2); }
.calc-fields input[type="text"], .calc-fields select { width: 100%; font-family: var(--font-sans); font-size: 18px; line-height: 26px; color: var(--ink); background: var(--sand); border: 2px solid var(--rule); border-radius: var(--radius-s); padding: 11px 14px; font-variant-numeric: tabular-nums; }
.calc-fields input[type="text"]:focus, .calc-fields select:focus { border-color: var(--rust); outline: none; box-shadow: 0 0 0 3px var(--stone-soft); }
.calc-radio { display: grid; gap: var(--space-2); }
.calc-radio label { display: flex; align-items: center; gap: var(--space-2); font-weight: 400; margin: 0; cursor: pointer; }
.calc-radio input { accent-color: var(--rust); width: 18px; height: 18px; }
.calc-out { background: var(--stone-soft); border-radius: var(--radius-m); padding: var(--space-6); display: grid; gap: var(--space-2); }
.calc-total-l { font-size: 15px; font-weight: 700; color: var(--ink-muted); }
.calc-total { font-family: var(--font-display); font-size: 46px; line-height: 52px; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.calc-rows { display: grid; }
.calc-rows > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) 0; border-top: 1px solid rgba(30, 43, 51, 0.15); font-size: 16px; font-variant-numeric: tabular-nums; }
.calc-next { font-size: 16px; line-height: 24px; margin-top: var(--space-2); }
.calc-next a { font-weight: 700; }
@media (max-width: 560px) { .calc { padding: var(--space-4); } }

/* Thank-you page */
.thanks { padding-top: var(--space-12); }
.thanks .card { max-width: 760px; margin: 0 auto; background: var(--sand-light); border-radius: var(--radius-l); box-shadow: var(--shadow-soft); overflow: hidden; }
.thanks .hero-strip { background: var(--slate); color: var(--on-slate); padding: var(--space-12) var(--space-12) var(--space-8); }
.thanks .hero-strip h1 { color: inherit; margin-bottom: var(--space-3); }
.thanks .hero-strip .lede { color: inherit; margin: 0; }
.thanks .check-circle { width: 56px; height: 56px; border-radius: 50%; background: #d4a27f; display: grid; place-items: center; margin-bottom: var(--space-4); }
.thanks .check-circle svg { width: 28px; height: 28px; fill: none; stroke: #1e2b33; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.thanks .hero-strip .eyebrow { background: rgba(255, 255, 255, 0.16); color: inherit; }
.thanks .body { padding: var(--space-8) var(--space-12) var(--space-12); }
.thanks .body h2 { font-size: 26px; line-height: 34px; margin: 0 0 var(--space-4); }
.thanks .body h2 + .steps, .thanks .body h2 + div { margin-bottom: var(--space-8); }
.thanks .steps { display: grid; gap: var(--space-4); }
.thanks .next-step { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.thanks .step-pill { justify-self: start; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; background: var(--stone-soft); border-radius: var(--radius-full); padding: 3px 12px; }
.thanks .step-text-title { font-weight: 700; }
.thanks .step-text-desc { color: var(--ink-muted); font-size: 16px; line-height: 25px; }
.thanks .detail-row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--rule); font-size: 17px; }
.thanks .detail-label { color: var(--ink-muted); }
.thanks .detail-value { font-weight: 700; text-align: right; }
.thanks .cta-row { margin: var(--space-8) 0 var(--space-6); }
.thanks .btn-primary { display: inline-flex; font-weight: 700; padding: 15px 26px; border-radius: 10px; background: var(--slate); color: var(--on-slate); text-decoration: none; }
.thanks .help-note { font-size: 16px; line-height: 25px; color: var(--ink-muted); }
@media (max-width: 640px) {
  .thanks .hero-strip { padding: var(--space-8) var(--space-6) var(--space-6); }
  .thanks .body { padding: var(--space-6); }
  .thanks .next-step { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
}

/* Skip link */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--space-4); top: var(--space-4); z-index: 60; background: var(--sand-light); padding: var(--space-2) var(--space-3); border-radius: var(--radius-s); }

/* Centre the reading column on wide screens */
@media (min-width: 1000px) {
  main.wrap > .crumbs, main.wrap > .article { max-width: var(--measure); margin-left: auto; margin-right: auto; }
  main.wrap > .doc { margin-left: auto; margin-right: auto; }
  .guide-group .guide-list[data-n="7"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Mobile pass: no wrapping header, 44px touch targets, bigger radio buttons */
.site-nav, .site-nav summary, .wordmark { white-space: nowrap; }
.header-inner { padding-block: var(--space-2); }
.wordmark { min-height: 44px; align-items: center; }
.site-nav > a:not(.btn), .site-nav summary { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 760px) { .site-nav > a.hide-sm { display: none; } }
.site-nav summary::after { margin-left: 5px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.crumbs a { display: inline-block; padding-block: 11px; margin-block: -11px; }
@media (pointer: coarse) { .guides-panel a { padding: 11px 0; } }
.calc-radio label { min-height: 44px; }
.calc-radio input { font-size: 16px; width: 22px; height: 22px; }
