/* Ministry of Justice, justice.govll.org
   Palette: deep plum (the judiciary's colour here) on warm stone paper, with a
   brass accent taken from the star on the Links Land flag.
   Motif: the double ruled margin of a legal document. It sits beside page
   headings and numbered explainer sections, and nowhere else. */

/* Fonts are served from this site, so no visitor data goes to a font CDN. */
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
    --plum-950: #1f0e23;
    --plum-900: #2d1433;
    --plum-800: #3d1a45;
    --plum-700: #522159;
    --plum-100: #f0e9f1;
    --brass-600: #8c5a1a;
    --brass-500: #b5762d;
    --paper: #f6f4f0;
    --surface: #ffffff;
    --line: #cfc9d1;
    --line-strong: #8f8494;
    --ink: #1d1b21;
    --ink-muted: #4f4955;
    --focus-dark: #ffd27a;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --cta-height: 52px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
}

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .6em; color: var(--plum-900); }
h1 { font-size: clamp(2rem, 4.4vw, 2.85rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-family: var(--sans); font-size: 1rem; font-weight: 700; color: var(--ink); }
p, ul, ol { margin: 0 0 1em; }

a { color: var(--plum-700); text-underline-offset: 2px; }
a:hover { color: var(--plum-950); text-decoration-thickness: 2px; }

/* Plain :focus (not :focus-visible) so the ring shows on every focus, mouse
   clicks included. Never transparent or none: Windows High Contrast relies
   on it. Dark areas switch the ring to a light colour further down. */
a:focus, button:focus, summary:focus, input:focus, select:focus, textarea:focus, [tabindex]:focus {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}
main:focus { outline: none; }
main:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

@media (forced-colors: active) {
    a:focus, button:focus, summary:focus, [tabindex]:focus { outline-color: Highlight; }
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -80px; z-index: 200;
    background: var(--plum-950); color: #fff; padding: 10px 16px; font-weight: 700;
}
.skip-link:focus { top: 12px; outline-color: var(--focus-dark); }

.top-strip { height: 4px; background: var(--brass-500); }

/* Masthead: white, with the arms, and a ruled navigation row underneath. */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-bar { display: flex; align-items: center; gap: 20px; padding-top: 14px; padding-bottom: 14px; }

.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand img { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.brand-text { display: grid; line-height: 1.25; }
.brand-parent { font-size: .82rem; color: var(--ink-muted); }
.brand-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--plum-800); }

.masthead-contact { font-size: .92rem; font-weight: 600; }

.nav-toggle {
    display: none;
    font: inherit; font-weight: 700; font-size: .95rem;
    color: var(--plum-800); background: var(--surface);
    border: 1px solid var(--plum-800); border-radius: 2px; padding: 6px 14px; cursor: pointer;
}

.primary-nav { border-top: 1px solid var(--line); }
#site-nav { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 4px 28px; }
#site-nav a {
    display: block; padding: 12px 0 10px;
    color: var(--ink); font-weight: 600; font-size: .97rem; text-decoration: none;
    border-bottom: 3px solid transparent;
}
#site-nav a:hover { color: var(--plum-700); border-bottom-color: var(--line-strong); }
#site-nav a[aria-current="page"] { color: var(--plum-800); border-bottom-color: var(--brass-500); }

/* Breadcrumbs */
.breadcrumbs { background: var(--paper); border-bottom: 1px solid var(--line); font-size: .9rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; margin-bottom: 0; }
.breadcrumbs li { color: var(--ink-muted); }
.breadcrumbs li + li::before { content: "/"; margin: 0 .6em; color: var(--line-strong); }

/* The ruled margin motif. A double rule, like the margin of a court document. */
.margin-rule { border-left: 4px double var(--plum-700); padding-left: 1.4rem; }

.page-head { padding: 2.6rem 0 2.2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.page-head h1 { margin-bottom: .35em; }
.lead { font-size: 1.2rem; color: var(--ink-muted); max-width: 62ch; margin-bottom: 0; }
.error-code { font-weight: 700; color: var(--brass-600); margin-bottom: .4rem; }

.page-body { padding-top: 2.5rem; padding-bottom: 2.5rem; }

/* Buttons: square, flat. */
.button {
    display: inline-block; padding: 12px 22px;
    font-weight: 700; font-size: 1rem; text-decoration: none;
    border: 2px solid var(--plum-800); border-radius: 2px;
    background: var(--plum-800); color: #fff;
}
.button:hover { background: var(--plum-950); border-color: var(--plum-950); color: #fff; }
.button-secondary { background: var(--surface); color: var(--plum-800); }
.button-secondary:hover { background: var(--plum-100); color: var(--plum-950); }

/* Home: light hero with the ruled margin, and a dark index panel beside it. */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 3rem 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.hero h1 { max-width: 18ch; }
.hero .lead { margin-bottom: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-index { background: var(--plum-900); color: #fff; padding: 22px 24px 10px; }
.hero-index h2 { color: #fff; font-size: 1.15rem; margin-bottom: .5rem; }
.hero-index ul { list-style: none; padding: 0; }
.hero-index li { border-top: 1px solid rgba(255, 255, 255, .22); }
.hero-index a { display: block; padding: 10px 0; color: #fff; font-weight: 600; text-decoration: none; }
.hero-index a:hover { text-decoration: underline; }
.hero-index a:focus { outline-color: var(--focus-dark); }

/* Article layout: an "On this page" list beside numbered sections. */
.article-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px; align-items: start; }
.article-layout.no-contents { grid-template-columns: minmax(0, 1fr); }
.article-layout.no-contents .article-body { max-width: 760px; }
.article-body { max-width: 720px; }

.contents { position: sticky; top: 20px; font-size: .95rem; }
.contents h2 { font-family: var(--sans); font-size: .95rem; color: var(--ink); margin-bottom: .6rem; }
.contents ol { padding-left: 1.3rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.contents li { margin-bottom: .45rem; }

.clause { position: relative; border-left: 4px double var(--plum-700); padding: 0 0 .2rem 1.4rem; margin: 0 0 2.4rem 2.6rem; scroll-margin-top: 20px; }
.clause-number {
    position: absolute; left: -2.9rem; top: .05rem; width: 2rem; text-align: right;
    font-family: var(--serif); font-size: 1.45rem; font-weight: 700; color: var(--brass-600);
}
.article-layout.no-contents .clause { margin-left: 2.6rem; }

.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .35rem; }

.note { background: var(--plum-100); border: 1px solid #d8c9db; padding: 18px 22px; margin: 0 0 2.2rem; }
.note-title { font-family: var(--sans); font-size: 1.02rem; color: var(--ink); margin-bottom: .4rem; }

.comparison { margin: 0 0 2.4rem; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: var(--surface); }
.comparison-col { padding: 20px 22px; }
.comparison-col + .comparison-col { border-left: 1px solid var(--line); }

.act-ref { border: 1px solid var(--line); border-top: 3px solid var(--brass-500); background: var(--surface); padding: 16px 20px; margin: 0 0 2.2rem; }
.act-ref p { margin-bottom: .4rem; }
.act-ref-label { font-size: .85rem; font-weight: 700; color: var(--brass-600); }
.act-ref-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.act-ref-source { font-size: .88rem; color: var(--ink-muted); margin-bottom: 0 !important; }

.contact-panel { background: var(--surface); border: 1px solid var(--line); padding: 24px 26px; margin: 0 0 2.2rem; }
.contact-address { font-family: var(--serif); font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 700; overflow-wrap: anywhere; }

.figure { margin: 0 0 2.2rem; }
.figure img { max-width: 100%; height: auto; display: block; border: 1px solid var(--line); }
.figure figcaption { font-size: .9rem; color: var(--ink-muted); margin-top: .5rem; }

/* Courts: the ladder. Each tier steps further right the higher it sits. */
.ladder-section { margin-bottom: 3rem; }
.ladder-hint { color: var(--ink-muted); max-width: 62ch; }
.ladder { list-style: none; padding: 0; margin: 1.6rem 0 0; max-width: 860px; }
.rung { --step: 0; margin-left: calc(var(--step) * 3.2rem); }
.rung-4 { --step: 3; }
.rung-3 { --step: 2; }
.rung-2 { --step: 1; }
.rung-box {
    display: grid; grid-template-columns: 4.5rem 13rem minmax(0, 1fr); gap: 4px 18px; align-items: baseline;
    background: var(--surface); border: 1px solid var(--line-strong); padding: 14px 18px;
}
.rung-tier { font-size: .85rem; font-weight: 700; color: var(--brass-600); }
.rung-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--plum-800); }
.rung-summary { color: var(--ink-muted); font-size: .97rem; }
.rung:first-child .rung-box { background: var(--plum-900); border-color: var(--plum-900); }
.rung:first-child .rung-name, .rung:first-child .rung-summary { color: #fff; }
.rung:first-child .rung-tier { color: #f0c88f; }
.rung:first-child .rung-name:focus { outline-color: var(--focus-dark); }
.rung-step {
    margin: 0 0 0 1.6rem; padding: 8px 0 8px 1.2rem;
    border-left: 2px solid var(--line-strong); font-size: .92rem; font-weight: 600; color: var(--ink-muted);
}

.tier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-bottom: 3rem; }
.tier { background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 24px; scroll-margin-top: 20px; }
.tier-number { font-size: .85rem; font-weight: 700; color: var(--brass-600); margin-bottom: .3rem; }
.tier ul { padding-left: 1.3rem; }
.tier p:last-child { margin-bottom: 0; }

/* FAQs: native details and summary. */
.faqs { padding: 2.6rem 0; border-top: 1px solid var(--line); }
.faq-list { max-width: 820px; border-top: 1px solid var(--line-strong); }
.faq { border-bottom: 1px solid var(--line-strong); }
.faq summary {
    cursor: pointer; list-style: none; position: relative;
    padding: 16px 2.4rem 16px 0; font-weight: 700; font-size: 1.05rem; color: var(--plum-900);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+"; position: absolute; right: 6px; top: 12px;
    font-family: var(--serif); font-size: 1.5rem; line-height: 1; color: var(--plum-700);
}
.faq[open] summary::after { content: "\2212"; }
.faq .prose { padding: 0 0 18px; max-width: 70ch; }

/* Related pages: a ruled list, closing every page. */
.related { background: var(--surface); border-top: 1px solid var(--line); padding: 2.4rem 0 2.8rem; }
.related h2 { font-size: 1.35rem; }
.related-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 32px; }
.related-list li { border-top: 2px solid var(--plum-800); padding: 12px 0 16px; }
.related-list a { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.related-list p { margin: .35rem 0 0; color: var(--ink-muted); font-size: .95rem; }

.not-found h2 { font-size: 1.35rem; }

/* Footer */
.site-footer { background: var(--plum-950); color: #e9e2ea; padding: 2.6rem 0 1.4rem; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer a:focus { outline-color: var(--focus-dark); }
.site-footer h2 { font-family: var(--sans); font-size: .95rem; color: #fff; margin-bottom: .7rem; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: .45rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: #fff; margin-bottom: .5rem; }
.footer-legal {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
    border-top: 1px solid rgba(255, 255, 255, .2); margin-top: 1.6rem; padding-top: 1.2rem;
}
.footer-legal ul { display: flex; gap: 24px; margin: 0; }
.footer-legal p { margin: 0; color: #cfc4d1; }

/* Mobile sticky CTA. Hidden on wider screens. The body gets matching bottom
   padding so the bar never sits over the footer or content. */
.mobile-cta { display: none; }

@media (max-width: 900px) {
    .hero-grid, .article-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .contents { position: static; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
    body { font-size: 1rem; padding-bottom: var(--cta-height); }
    .container { padding: 0 16px; }
    .masthead-contact { display: none; }
    .js .nav-toggle { display: inline-block; }
    .brand img { width: 42px; height: 42px; }
    .brand-name { font-size: 1.25rem; }
    .brand-parent { font-size: .75rem; }
    .js .primary-nav { display: none; }
    .js .primary-nav.open { display: block; }
    #site-nav { flex-direction: column; gap: 0; }
    #site-nav li + li { border-top: 1px solid var(--line); }
    #site-nav a { padding: 12px 0; border-bottom: 0; border-left: 3px solid transparent; }
    #site-nav a[aria-current="page"] { border-left-color: var(--brass-500); padding-left: 10px; }

    .hero { padding: 2rem 0; }
    .margin-rule { padding-left: 1rem; }
    .clause { margin-left: 0; padding-left: 1rem; }
    .article-layout.no-contents .clause { margin-left: 0; }
    .clause-number { position: static; display: block; width: auto; text-align: left; font-size: 1.05rem; margin-bottom: .2rem; }
    .comparison-grid { grid-template-columns: 1fr; }
    .comparison-col + .comparison-col { border-left: 0; border-top: 1px solid var(--line); }

    .rung { margin-left: calc(var(--step) * .9rem); }
    .rung-box { grid-template-columns: 1fr; }
    .tier-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }

    .mobile-cta {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        height: var(--cta-height); background: var(--plum-900); border-top: 2px solid var(--brass-500);
    }
    .mobile-cta a {
        display: flex; align-items: center; justify-content: center; height: 100%;
        color: #fff; font-weight: 700; text-decoration: none;
    }
    .mobile-cta a:focus { outline: 3px solid var(--focus-dark); outline-offset: -5px; }
}

@media print {
    .mobile-cta, .primary-nav, .nav-toggle, .hero-actions, .contents, .related { display: none !important; }
    body { background: #fff; padding: 0; }
}
