/* AIAPQ — legal research in custody. Full-bleed shell, mobile first, keyboard first, no JavaScript.
   The page runs the whole width of the desktop, held in by a tiny gutter and nothing else; reading
   comfort comes from columns that share that width, never from a narrow centred shell. Palette and
   type scale are documented in DESIGN.md. Dark scheme only. Every size is in rem so browser text zoom
   (200%) scales the whole page without clipping; html is 112.5%, so 1rem = 18px and the px values the
   owner specified are carried as rem that land exactly on them. Breakpoints are written in rem and,
   in a media query, 1rem = 16px: 48rem = 768px, 80rem = 1280px, 100rem = 1600px. */

:root{
  color-scheme:dark;

  /* palette — roles, not moods. Dark scheme only; nothing outside this list. */
  --bg:#050b12;          /* page ground: near-black blue; the gradient's fallback */
  --bg-2:#0a1520;        /* surface-1: panels, cards, footer blocks */
  --bg-3:#0f1d2b;        /* surface-2: card hover, nested panel, notice ground */
  --bg-4:#13273a;        /* surface-3: deepest nested ground, table header */
  --line:#1a3346;        /* hairline rules */
  --line-2:#234358;      /* borders that must be seen */
  --ink:#dff6ff;         /* primary text */
  --ink-soft:#bfe9fd;    /* secondary text */
  --ink-dim:#7fb3cf;     /* meta labels only */
  --accent:#ffd45a;      /* gold: the primary accent — links, marks, focus, buttons */
  --accent-ink:#1a1405;  /* text placed on an --accent fill */
  --accent-2:#67dbc5;    /* teal: success states only, never primary */
  --accent-2-ink:#06201c;/* text placed on an --accent-2 fill */
  --bg-accent-2:#0c241f; /* ground of a success block */
  --link:#a78bfa;        /* text links inside darker panels only */

  --radius:10px;
  /* full-bleed shell: the only thing between content and the screen edge is this gutter.
     Stepped below, on the 768 / 1280 / 1600 reference widths. */
  --gutter:.75rem;
  --gap:clamp(1rem,2vw,2.75rem);      /* column gap, grows with the viewport */
  --rail:clamp(10rem,17vw,21rem);     /* heading column on wide rows */
}
@media (min-width:48rem){ :root{--gutter:1.25rem} }   /* 768px → 22.5px */
@media (min-width:80rem){ :root{--gutter:1.75rem} }   /* 1280px → 31.5px */
@media (min-width:100rem){ :root{--gutter:2.25rem} }  /* 1600px → 40.5px */

*{box-sizing:border-box}
html{
  -webkit-text-size-adjust:100%;
  font-size:112.5%;                  /* 1rem = 18px at the default 16px */
  scroll-behavior:smooth;
}
body{
  margin:0;
  min-height:100vh;
  background:var(--bg);              /* fallback if the gradient is ignored */
  background:linear-gradient(180deg,rgba(6,22,38,.82) 0%,#041016 60%,#030a10 100%);
  color:var(--ink);
  font:400 .8889rem/1.65 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; /* 16px */
  overflow-wrap:break-word;          /* long citations must not push the layout */
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--accent);color:var(--accent-ink)}

/* ---------- typography ---------- */
h1,h2,h3{
  font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-weight:700;
  line-height:1.2;
  letter-spacing:-.01em;
  margin:0 0 .6em;
  text-wrap:balance;                 /* big titles break evenly, never into a widow */
  overflow-wrap:break-word;
  hyphens:none;                      /* a headline is never hyphenated */
}
/* hero h1: 56px at desktop, never below 36px; tracks tight and sets solid */
h1{font-size:clamp(2rem,5.1vw,3.1111rem);font-weight:800;line-height:1.0;letter-spacing:-.02em}
h2{font-size:clamp(1.5rem,2.4vw,1.6667rem);line-height:1.2}   /* 27px → 30px */
h3{font-size:1.1111rem;font-weight:600;line-height:1.25}       /* 20px */
p{margin:0 0 1.1rem}
p:last-child{margin-bottom:0}
ul,ol{margin:0 0 1.1rem;padding-left:1.4em}
li{margin:0 0 .55rem}
li:last-child{margin-bottom:0}
strong{font-weight:700;color:var(--ink)}
hr{border:0;border-top:1px solid var(--line);margin:2rem 0}
code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.75rem;line-height:1.5} /* 13.5px */

a{color:var(--accent);text-underline-offset:3px;text-decoration-thickness:1px}
a:hover{color:var(--ink);text-decoration-thickness:2px}
a:focus-visible{outline:3px solid var(--accent);outline-offset:3px;border-radius:2px}
p a,li a,dt a,dd a{text-decoration:underline}
/* inline prose links inside the darker panels read violet; gold stays on open ground */
.panel a,.notice a,.demo a,.query a,.steps a,.ft-position a,.prose a{color:var(--link)}
.panel a:hover,.notice a:hover,.demo a:hover,.query a:hover,.steps a:hover,.ft-position a:hover,.prose a:hover{color:var(--ink)}

.lede{font-size:clamp(1.05rem,1.64vw,1.1667rem);line-height:1.4;font-weight:400;color:var(--ink-soft)} /* 21px */
/* long-form prose on a very wide screen: two columns that share the width instead of one long line */
.flow > *,.prose > *{break-inside:avoid}
@media (min-width:80rem){
  .flow,.prose{column-count:2;column-gap:clamp(2rem,4vw,5rem)}
}
.prose h2{margin-top:1.5em}
.prose > *:first-child{margin-top:0}

/* ---------- shell ---------- */
.wrap{width:100%;max-width:none;padding-inline:var(--gutter)}
main{display:block}

/* ---------- skip link ---------- */
.skip{
  position:absolute;left:-9999px;top:0;z-index:100;
  background:var(--accent);color:var(--accent-ink);
  padding:.7rem 1rem;font-weight:700;text-decoration:none;border-radius:0 0 var(--radius) 0
}
.skip:focus{left:0}

/* ---------- header: brand left, nav right, full width; static, so it can never cover content ---------- */
.site-header{border-bottom:1px solid var(--line);background:var(--bg-2)}
.hd-in{
  display:flex;flex-wrap:wrap;align-items:center;
  gap:.5rem 1.4rem;padding-block:.6rem
}
.brand{
  display:flex;align-items:center;gap:.6rem;
  text-decoration:none;color:var(--ink);font-weight:800;letter-spacing:.01em;
  font-size:1.12rem;line-height:1.1
}
.brand:hover{color:var(--ink)}
.brand svg{display:block;flex:none;width:30px;height:30px;color:var(--accent)}
.brand small{
  display:block;
  font-size:.6944rem;font-weight:500;line-height:1.2;letter-spacing:.16em;text-transform:uppercase;
  color:var(--ink-dim);margin-top:.2rem
}
.hd-nav{margin-left:auto}
.hd-nav ul{display:flex;flex-wrap:wrap;gap:.15rem;list-style:none;margin:0;padding:0}
.hd-nav li{margin:0}
.hd-nav a{
  display:block;padding:.5rem .55rem;border-radius:var(--radius);
  text-decoration:none;font-size:.7778rem;line-height:1.3;font-weight:500;color:var(--ink-soft)  /* 14px */
}
.hd-nav a:hover{background:var(--bg-3);color:var(--ink)}
.hd-nav a[aria-current="page"]{
  color:var(--ink);background:var(--bg-3);
  box-shadow:inset 0 -2px 0 0 var(--accent)
}
@media (min-width:60rem){ .hd-nav a{padding:.5rem .55rem} }              /* 960px: links fit on one row */
@media (min-width:80rem){ .hd-nav a{padding:.6rem .7rem} }

/* ---------- sections: a hairline between them, the full width inside ---------- */
section{padding-block:clamp(1.6rem,3vw,3rem)}
section+section{border-top:1px solid var(--line)}
section > .wrap > *:last-child{margin-bottom:0}

.eyebrow{
  font-size:.6944rem;font-weight:500;line-height:1.2;letter-spacing:.16em;text-transform:uppercase;
  color:var(--ink-dim);margin:0 0 1rem                                  /* 12.5px */
}

/* ---------- hero: headline left, support column right ---------- */
.hero{padding-block:clamp(1.6rem,3.4vw,3.4rem) clamp(1.2rem,2.6vw,2.6rem)}
.hero__grid{display:grid;gap:var(--gap);align-items:start}
.hero__head{grid-column:1}
.hero__side{grid-column:1}
@media (min-width:80rem){
  .hero__grid{
    /* the headline column takes two thirds: at 1280 the longest headline sets in three lines,
       at 1600 in two, and never in a hyphenated or clipped line */
    grid-template-columns:minmax(0,2fr) minmax(0,1fr);
    column-gap:clamp(2rem,4vw,5rem)
  }
  .hero__head{grid-column:1}
  .hero__side{grid-column:2}
}
.hero h1{margin-bottom:.5em}
.hero__side .notice,
.hero__side .panel,
.hero__side .demo,
.hero__side .query{margin-top:0;margin-bottom:0}

/* ---------- rail rows: heading column + content column ---------- */
.rail{display:grid;gap:var(--gap);align-items:start}
@media (min-width:80rem){
  .rail{
    grid-template-columns:var(--rail) minmax(0,1fr);
    column-gap:clamp(1.5rem,3vw,4rem)
  }
  .rail__head h2{margin-bottom:0}
}
.rail__head .eyebrow{margin-bottom:.7rem}
.rail__body > *:first-child{margin-top:0}

/* ---------- buttons: gold primary, gold-outline ghost ---------- */
.cta-row{display:flex;flex-wrap:wrap;gap:.6rem;margin-top:1.6rem}
.btn{
  display:inline-block;text-align:center;text-decoration:none;
  padding:.85rem 1.15rem;border-radius:var(--radius);
  border:1px solid var(--accent);
  background:transparent;color:var(--accent);
  font-weight:600;font-size:.7222rem;line-height:1;letter-spacing:.1em;text-transform:uppercase; /* 13px */
  transition:background-color 150ms ease,border-color 150ms ease,color 150ms ease
}
.btn:hover{background:var(--bg-3);color:var(--accent)}
.btn:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.btn--primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn--primary:hover{background:var(--ink);border-color:var(--ink);color:var(--accent-ink)}
.btn--primary:focus-visible{outline-color:var(--ink)}

/* ---------- the not-advice block: text, not colour, carries the meaning; the edge is gold ---------- */
.notice{
  background:var(--bg-3);
  border:1px solid var(--line-2);
  border-left:6px solid var(--accent);
  border-radius:var(--radius);
  padding:1.05rem 1.15rem;
  margin:1.7rem 0
}
.notice__label{
  display:block;
  font-size:.6944rem;font-weight:500;line-height:1.2;letter-spacing:.16em;text-transform:uppercase;
  color:var(--accent);margin:0 0 .55rem
}
.notice p{color:var(--ink-soft);margin:0 0 .7rem}
.notice p:last-child{margin-bottom:0}
.notice strong{color:var(--ink)}

/* ---------- panels and the full-width grids that carry them ---------- */
.panel{
  background:var(--bg-2);border:1px solid var(--line);
  border-radius:var(--radius);padding:1.05rem 1.15rem;margin:0 0 1.1rem
}
.panel h3{margin-bottom:.45rem}
.panel p{color:var(--ink-soft);margin-bottom:.5rem}
.panel p:last-child{margin-bottom:0}

.grid{display:grid;gap:var(--gap);margin:0;padding:0;list-style:none;grid-template-columns:1fr}
.grid > li{margin:0}
.grid .panel{height:100%;margin:0}
/* 1 column → 2 from 768px → 3 from 1280px → card rows of four from 1600px */
@media (min-width:48rem){
  .grid--2,.grid--3,.grid--4up{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (min-width:80rem){
  .grid--3{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (min-width:100rem){
  .grid--4up{grid-template-columns:repeat(4,minmax(0,1fr))}
}

.after-block{margin-top:1.8rem}

/* ---------- numbered sequence: cards that flow across the width ---------- */
.steps{
  counter-reset:step;list-style:none;padding:0;margin:0;
  display:grid;gap:var(--gap);grid-template-columns:1fr
}
@media (min-width:48rem){ .steps{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:80rem){ .steps{grid-template-columns:repeat(3,minmax(0,1fr))} }
.steps > li{
  counter-increment:step;position:relative;
  background:var(--bg-2);border:1px solid var(--line);border-radius:var(--radius);
  padding:1.05rem 1.15rem 1.05rem 3.5rem;margin:0
}
.steps > li::before{
  content:counter(step);
  position:absolute;left:1rem;top:.95rem;
  width:1.9rem;height:1.9rem;border-radius:50%;
  border:1px solid var(--line-2);background:var(--bg-4);
  color:var(--accent);font-weight:800;font-size:.7778rem;line-height:1.9rem;text-align:center
}
.steps h3{font-size:1.1111rem;font-weight:600;margin:0 0 .3rem}
.steps p{color:var(--ink-soft);margin:0}

/* ---------- example of an "Edited Version" message ---------- */
.demo{
  border:1px solid var(--line-2);border-radius:var(--radius);
  background:var(--bg-2);margin:1.4rem 0 0;overflow:hidden
}
.demo__bar{
  display:block;padding:.6rem .9rem;
  background:var(--accent);color:var(--accent-ink);
  font-size:.6944rem;font-weight:600;line-height:1.2;letter-spacing:.16em;text-transform:uppercase
}
.demo__body{
  padding:1rem 1.1rem;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.75rem;line-height:1.5;color:var(--ink)          /* 13.5px */
}
.demo__body p{margin:0 0 .7rem}
.demo__body p:last-child{margin:0}
.demo__note{font-size:.8889rem;color:var(--ink-dim);margin:.6rem 0 0}

/* ---------- question categories: a grid of definition pairs ---------- */
.query{display:grid;gap:var(--gap);margin:0;padding:0;grid-template-columns:1fr}
@media (min-width:48rem){ .query{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:80rem){ .query{grid-template-columns:repeat(3,minmax(0,1fr))} }
@media (min-width:100rem){ .query{grid-template-columns:repeat(4,minmax(0,1fr))} }
.query > div{
  border:1px solid var(--line);border-radius:var(--radius);
  background:var(--bg-2);padding:1.05rem 1.15rem
}
.query dt{font-weight:700;color:var(--ink);font-size:1rem;margin:0 0 .5rem}
.query dd{margin:0 0 .5rem;color:var(--ink-soft)}
.query dd:last-child{margin-bottom:0}
.query dd.example{color:var(--ink);font-style:italic;border-top:1px solid var(--line);padding-top:.6rem}
.query dd.example::before{content:"For example: ";font-style:normal;color:var(--ink-dim);font-weight:600}

/* ---------- success state: the only place teal may appear ---------- */
.status-ok{
  background:var(--bg-accent-2);border:1px solid var(--accent-2);
  color:var(--accent-2);border-radius:var(--radius);padding:.7rem .9rem;font-weight:600
}
.status-ok strong{color:var(--ink)}

/* ---------- tables: always inside a scroll container, so a page never scrolls sideways ---------- */
.table-scroll{max-width:100%;overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.8889rem}
caption{text-align:left;font-size:.6944rem;letter-spacing:.16em;text-transform:uppercase;color:var(--ink-dim);padding:0 0 .6rem}
th,td{text-align:left;padding:.6rem .7rem;border-bottom:1px solid var(--line);vertical-align:top}
thead th{background:var(--bg-4);color:var(--ink);font-size:.6944rem;letter-spacing:.16em;text-transform:uppercase}

/* ---------- footer: columns across the full width ---------- */
.site-footer{
  border-top:1px solid var(--line);background:var(--bg-2);
  padding-block:clamp(1.8rem,3vw,2.8rem) 1.4rem;margin-top:2rem
}
.ft-grid{display:grid;gap:var(--gap);grid-template-columns:1fr}
/* three footer blocks: the brand takes the width it needs, the two link lists share the rest */
@media (min-width:48rem){ .ft-grid{grid-template-columns:2fr 1fr 1fr} }
.ft-grid h2{
  font-size:.6944rem;font-weight:500;line-height:1.2;letter-spacing:.16em;text-transform:uppercase;
  color:var(--ink-dim);margin:0 0 .8rem
}
.ft-grid ul{list-style:none;margin:0;padding:0}
.ft-grid li{margin:0 0 .5rem}
.ft-grid a{color:var(--ink-soft);text-decoration:none;display:inline-block;padding:.2rem 0;overflow-wrap:anywhere}
.ft-grid a:hover{color:var(--ink);text-decoration:underline}
.ft-grid p{color:var(--ink-soft)}
.ft-brand{display:flex;align-items:center;gap:.6rem;font-weight:800;font-size:1.05rem;color:var(--ink)}
.ft-brand svg{display:block;flex:none;width:28px;height:28px;color:var(--accent)}
.ft-position{
  margin:1.6rem 0 0;padding:1.05rem 1.15rem;border-radius:var(--radius);
  border:1px solid var(--line-2);border-left:6px solid var(--accent);background:var(--bg-3);
  color:var(--ink);font-weight:600
}
.ft-bottom{
  margin-top:1.4rem;padding-top:1rem;border-top:1px solid var(--line);
  font-size:.8889rem;color:var(--ink-dim)
}
.ft-bottom p{color:var(--ink-dim);margin:0}
.ft-cookie{margin:.55rem 0 0;font-size:.76rem;line-height:1.5;color:var(--ink-dim)}
.ft-cookie a{color:var(--link)}


/* ---------- accessibility affordances ---------- */
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
  html{scroll-behavior:auto}
}
@media (prefers-contrast:more){
  :root{--ink:#ffffff;--ink-soft:#eaf8ff;--ink-dim:#b9d9e8;--line:#3d6a86;--line-2:#5d8aa4;--accent:#ffe28c;--link:#c9b6ff}
}
@media print{
  :root{--bg:#fff;--bg-2:#fff;--bg-3:#fff;--bg-4:#fff;--ink:#000;--ink-soft:#000;--ink-dim:#222;--accent:#6b4a00;--accent-ink:#fff;--link:#3a1f8a;--line:#999;--line-2:#666}
  html{scroll-behavior:auto}
  body{background:#fff;color:#000;min-height:0}
  .site-header,.site-footer{display:none}
  .flow,.prose{column-count:1}
}

/* mobile header menu: the inline list from 960px, the details menu below that */
.hd-menu{display:none}
@media (max-width:59.999rem){
  /* only pages that carry the burger hide the inline list; terms, privacy and credits-thanks have no
     burger in their markup, so there the six links stay visible and simply wrap under the brand */
  .hd-in:has(.hd-menu) .hd-nav{display:none}
  .hd-in:not(:has(.hd-menu)) .hd-nav{width:100%;margin-left:0}
  .hd-menu{display:block;position:relative;margin-left:auto}
  .hd-menu summary{list-style:none;cursor:pointer;display:inline-flex;flex-direction:column;justify-content:center;gap:5px;width:44px;height:44px;padding:10px;background:transparent;border:1px solid var(--line-2);border-radius:.6rem;margin:0}
  .hd-menu summary::-webkit-details-marker{display:none}
  .hd-menu summary::marker{content:""}
  .hd-menu summary span{display:block;height:2px;width:100%;background:var(--ink);border-radius:2px;transition:transform .2s ease,opacity .15s ease}
  .hd-menu[open] summary span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .hd-menu[open] summary span:nth-child(2){opacity:0}
  .hd-menu[open] summary span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
  .hd-menu ul{position:absolute;right:0;top:calc(100% + .4rem);z-index:20;min-width:11rem;margin:0;padding:.4rem;list-style:none;display:flex;flex-direction:column;background:var(--bg-2);border:1px solid var(--line-2);border-radius:.6rem;box-shadow:0 10px 30px rgba(5,11,18,.75)}
  .hd-menu li{margin:0}
  .hd-menu a{display:block;padding:.55rem .7rem;border-radius:.35rem;font-size:.7778rem;color:var(--ink);text-decoration:none}
  .hd-menu a:hover,.hd-menu a:focus-visible{background:var(--bg-3)}
}


/* contact form */
.contact-form{margin:0 0 1.2rem}
.contact-form p{margin:0 0 1rem}
.contact-form label{display:block;font-size:.7778rem;letter-spacing:.02em;color:var(--ink-soft);margin:0 0 .35rem}
.contact-form input,.contact-form textarea{display:block;width:100%;max-width:44rem;box-sizing:border-box;padding:.6rem .7rem;background:var(--bg-3);color:var(--ink);border:1px solid var(--line-2);border-radius:.45rem;font:inherit}
.contact-form input:focus,.contact-form textarea:focus{outline:2px solid var(--accent);outline-offset:1px}
.contact-form .small{font-size:.7778rem;color:var(--ink-dim);max-width:44rem}
