/* ============================================================
   COURTS CANADA — design system
   Burnt-red masthead with a gold maple leaf, centred crest-style
   header, warm paper page, gold hairlines, serif display type.
   ============================================================ */

:root {
  --red:          #8a1f17;   /* masthead, H1, table heads */
  --red-deep:     #641610;   /* nav strip, footer */
  --red-dark:     #3f0d09;
  --red-soft:     #f7ebe7;
  --gold:         #c9a13b;   /* leaf, rules, active nav on red */
  --gold-light:   #e6c879;
  --gold-text:    #7d5f12;   /* gold that passes contrast on paper */
  --link:         #8a1f17;
  --link-visited: #5c2a4d;
  --text:         #2a2522;
  --text-2:       #4a423d;
  --muted:        #6e655e;
  --bg:           #faf7f1;
  --card:         #ffffff;
  --panel:        #f3ede2;
  --border:       #ddd2bf;
  --border-light: #ebe3d4;
  --focus:        #d4a017;
  --radius:       6px;
  --max:          1160px;
  --font-sans:    'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-serif:   'Spectral', Georgia, 'Times New Roman', serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; display: flex; flex-direction: column;
  font-family: var(--font-sans); font-size: 1.0625rem; line-height: 1.6;
  color: var(--text); background: var(--bg);
}
a { color: var(--link); text-decoration-color: rgba(138, 31, 23, .35); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:visited { color: var(--link-visited); }
a:hover { color: var(--red-deep); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--red-dark); padding: .5rem 1rem; z-index: 999; font-weight: 700; }
.skip-link:focus { left: 0; }

h1, h2, h3, h4 { color: var(--red-dark); line-height: 1.2; margin: 0 0 .75rem; }
h1 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(1.85rem, 3.6vw, 2.6rem); color: var(--red); }
h2 { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 600; margin-top: 2.25rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
code, .mono { font-family: var(--font-mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
main { flex: 1; }
.page { padding-top: 2rem; padding-bottom: 3.5rem; }

/* ---- Masthead: centred crest ---- */
.masthead {
  background:
    radial-gradient(ellipse at 50% -40%, rgba(255, 220, 150, .16), transparent 60%),
    var(--red);
  color: #fff; border-top: 5px solid var(--gold); text-align: center;
}
.masthead-inner { display: flex; flex-direction: column; align-items: center; padding: 1.4rem 1.25rem 1.1rem; position: relative; }
.brand { display: inline-flex; flex-direction: column; align-items: center; gap: .55rem; color: #fff; text-decoration: none; }
.brand:visited, .brand:hover { color: #fff; }
.brand-leaf { width: 54px; height: 54px; flex-shrink: 0; filter: drop-shadow(0 1px 0 rgba(0,0,0,.25)); }
.brand-name { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1; }
.brand-rule { display: flex; align-items: center; gap: .7rem; color: var(--gold-light); font-size: .74rem; letter-spacing: .26em; text-transform: uppercase; }
.brand-rule::before, .brand-rule::after { content: ""; width: 34px; height: 1px; background: var(--gold); }

.navstrip { background: var(--red-deep); border-bottom: 3px solid var(--gold); }
.menu { display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem; }
.menu a { color: #f6e9d5; text-decoration: none; font-size: .86rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: .85rem 1.05rem .7rem; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.menu a:hover { color: #fff; background: rgba(255,255,255,.06); }
.menu a[aria-current="page"] { color: var(--gold-light); border-bottom-color: var(--gold-light); }
.menu-toggle { display: none; position: absolute; right: 1.25rem; top: 1.25rem; background: transparent; border: 1px solid var(--gold); color: var(--gold-light); padding: .4rem .75rem; font: inherit; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; border-radius: var(--radius); cursor: pointer; }

/* Independence ribbon, under the header */
.ribbon { background: var(--panel); border-bottom: 1px solid var(--border); font-size: .84rem; color: var(--text-2); }
.ribbon .wrap { display: flex; justify-content: center; align-items: center; gap: .6rem 1.5rem; flex-wrap: wrap; padding-top: .45rem; padding-bottom: .45rem; text-align: center; }
.ribbon .flag::before { content: "◆"; color: var(--gold); margin-right: .45rem; font-size: .7rem; vertical-align: 1px; }
.ribbon a { color: var(--red); font-weight: 600; }

/* ---- Breadcrumb ---- */
.crumbs { font-size: .86rem; color: var(--muted); margin: 0 0 1.25rem; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; }
.crumbs li + li::before { content: "/"; margin-right: .4rem; color: var(--gold); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ---- Kicker / page head ---- */
.kicker { font-size: .74rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 .45rem; }
.page-head { padding-bottom: 1.25rem; margin-bottom: 1.75rem; position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; bottom: 0; width: 72px; height: 3px; background: var(--gold); }
.page-head .lede { color: var(--text-2); font-size: 1.12rem; max-width: 68ch; margin: .5rem 0 0; }
.cite { font-size: .88rem; color: var(--muted); margin-top: .6rem; }

/* ---- Layout: main + rail ---- */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 2.25rem; align-items: start; }
.rail { background: var(--card); border: 1px solid var(--border-light); border-top: 3px solid var(--red); border-radius: var(--radius); padding: 1.2rem 1.3rem; font-size: .93rem; position: sticky; top: 1rem; }
.rail h2 { font-family: var(--font-sans); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 .65rem; }
.rail h2:not(:first-child) { margin-top: 1.35rem; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { padding: .35rem 0; border-bottom: 1px dotted var(--border); }
.rail li:last-child { border-bottom: 0; }
.rail p { margin: 0; color: var(--text-2); }

/* ---- Search ---- */
.search { display: grid; grid-template-columns: minmax(0, 1fr) 230px auto; gap: .6rem; }
.search input, .search select, .search button {
  font: inherit; font-size: 1rem; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); min-width: 0;
}
.search input:focus, .search select:focus { border-color: var(--red); outline: 3px solid rgba(212, 160, 23, .45); outline-offset: 0; }
.search button { background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; padding: .75rem 1.6rem; cursor: pointer; }
.search button:hover { background: var(--red-deep); }
.search-panel { background: var(--card); border: 1px solid var(--border-light); border-left: 5px solid var(--gold); border-radius: var(--radius); padding: 1.4rem 1.5rem; margin: 0 0 2.25rem; box-shadow: 0 1px 2px rgba(63, 13, 9, .05); }
.search-panel h2 { margin: 0 0 .9rem; font-size: 1.15rem; }
.search-help { font-size: .86rem; color: var(--muted); margin: .65rem 0 0; }

/* ---- Jurisdiction grid (home) ---- */
.index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .75rem; }
.index a { display: grid; grid-template-columns: 3rem minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .85rem; align-items: center; padding: .85rem 1rem; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.index a:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(63, 13, 9, .08); }
.index-code { grid-row: 1 / span 2; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--red); color: var(--gold-light); font-weight: 700; font-size: .8rem; letter-spacing: .06em; }
.index-title { color: var(--red-dark); font-weight: 600; }
.index-meta { font-size: .82rem; color: var(--muted); }

/* ---- Tables ---- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th, .tbl td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.tbl th { background: var(--red); color: #fff; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; white-space: nowrap; }
.tbl tbody tr:nth-child(even) { background: #fcfaf6; }
.tbl tbody tr:hover { background: var(--red-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .name a { font-weight: 600; }
.tbl caption { text-align: left; caption-side: top; font-size: .86rem; color: var(--muted); padding: .7rem .8rem; background: var(--panel); border-bottom: 1px solid var(--border-light); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .08em; background: var(--gold-light); color: var(--red-dark); padding: .1rem .5rem; border-radius: 999px; line-height: 1.4; vertical-align: middle; }
.tag-muted { background: var(--panel); color: var(--muted); }
.tag-ok { background: #e3efe0; color: #2d5a27; }

/* ---- Definition list (record) ---- */
.dl { display: grid; grid-template-columns: 190px minmax(0, 1fr); margin: 0; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; }
.dl dt, .dl dd { padding: .65rem .9rem; border-bottom: 1px solid var(--border-light); margin: 0; }
.dl dt { font-size: .82rem; font-weight: 700; color: var(--gold-text); background: #fcfaf6; }
.dl dd { color: var(--text); overflow-wrap: anywhere; }
.dl dt:nth-last-of-type(1), .dl dd:last-child { border-bottom: 0; }
.section-label { font-family: var(--font-serif); font-size: 1.15rem; color: var(--red-dark); margin: 2rem 0 .7rem; }

/* ---- Notices ---- */
.notice { border: 1px solid #e6cfc9; border-left: 5px solid var(--red); background: var(--red-soft); border-radius: var(--radius); padding: .95rem 1.15rem; font-size: .94rem; color: var(--text-2); margin: 1.5rem 0; }
.notice strong { color: var(--red); }
.note { border: 1px solid var(--border-light); background: var(--panel); border-radius: var(--radius); padding: .95rem 1.15rem; font-size: .93rem; color: var(--text-2); margin: 1.5rem 0; }
.source-block { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: 1.05rem 1.3rem; font-size: .92rem; margin: 1.75rem 0; }
.source-block h2 { font-family: var(--font-sans); margin: 0 0 .55rem; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text); }
.source-block dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; gap: .3rem .8rem; }
.source-block dt { color: var(--muted); }
.source-block dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: 2rem 0; }
.stat { background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 1rem 1.15rem; }
.stat b { display: block; font-family: var(--font-serif); font-size: 1.7rem; color: var(--red); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { font-size: .82rem; color: var(--muted); }

/* ---- Pagination ---- */
.pager { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1.5rem 0; font-size: .92rem; }
.pager a, .pager span { padding: .35rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; background: var(--card); }
.pager span[aria-current] { background: var(--red); color: #fff; border-color: var(--red); }

/* ---- Prose pages ---- */
.prose { max-width: 70ch; }
.prose p, .prose li { color: var(--text-2); }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: .4rem; }
.prose li::marker { color: var(--gold); }

/* ---- Buttons ---- */
.btn { display: inline-block; background: var(--red); color: #fff; text-decoration: none; padding: .6rem 1.25rem; font-weight: 700; font-size: .9rem; border: 1px solid var(--red); border-radius: var(--radius); }
.btn:visited { color: #fff; }
.btn:hover { background: var(--red-deep); color: #fff; }
.btn-outline { background: transparent; color: var(--red); }
.btn-outline:hover { background: var(--red-soft); color: var(--red); }

/* ---- Directory ---- */
.dir-court { background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: .9rem 1.1rem; margin: 0 0 .65rem; }
.dir-court h3 { margin: 0 0 .2rem; font-family: var(--font-serif); font-size: 1.08rem; color: var(--red-dark); }
.dir-court .alt { font-size: .86rem; color: var(--muted); font-style: italic; }
.dir-court p { margin: .35rem 0 0; font-size: .9rem; color: var(--text-2); }
.dir-locs { font-size: .86rem; color: var(--muted); margin-top: .4rem; }
.dir-locs summary { cursor: pointer; color: var(--red); }

/* ---- Footer ---- */
.footer { background: var(--red-dark); color: #e9dccb; margin-top: 3rem; font-size: .9rem; border-top: 4px solid var(--gold); }
.footer .wrap { padding-top: 2.5rem; padding-bottom: 2rem; }
.footer-top { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid rgba(201, 161, 59, .35); }
.footer-top svg { width: 30px; height: 30px; }
.footer-top span { font-family: var(--font-serif); font-size: 1.2rem; letter-spacing: .12em; text-transform: uppercase; color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr; gap: 2rem; }
.footer h2 { font-family: var(--font-sans); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-light); margin: 0 0 .8rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0 0 .35rem; }
.footer a, .footer a:visited { color: #f4e8d6; text-decoration-color: rgba(230, 200, 121, .4); }
.footer a:hover { color: #fff; }
.footer-cols { columns: 2; column-gap: 1rem; }
.footer-independence { border-left: 3px solid var(--gold); padding: .2rem 0 .2rem .9rem; margin: 0 0 1rem; color: #fff; }
.footer-meta { border-top: 1px solid rgba(201, 161, 59, .35); margin-top: 2rem; padding-top: 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; font-size: .82rem; color: #c9b8a2; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .rail { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .masthead { text-align: left; }
  .masthead-inner { align-items: flex-start; padding: .9rem 1.25rem; }
  .brand { flex-direction: row; gap: .7rem; }
  .brand-leaf { width: 38px; height: 38px; }
  .brand-name { font-size: 1.25rem; letter-spacing: .1em; }
  .brand-rule { display: none; }
  .menu-toggle { display: inline-block; top: 50%; transform: translateY(-50%); }
  .navstrip { border-bottom-width: 2px; }
  .menu { display: none; flex-direction: column; }
  .menu.open { display: flex; }
  .menu a { padding: .8rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); margin: 0; text-align: left; }
  .search { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: .1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .source-block dl { grid-template-columns: 1fr; }
}
@media print {
  .ribbon, .navstrip, .menu-toggle, .footer, .search-panel, .pager, .crumbs { display: none !important; }
  .masthead { background: #fff; color: #000; border-top: 0; border-bottom: 2px solid #000; }
  .brand, .brand-rule { color: #000 !important; }
  a { color: #000; text-decoration: none; }
  body { font-size: 11pt; background: #fff; }
}
