/* ============ my.adhd — the legal pages ============
   Long-form prose, which the site has not had anywhere else: the landing
   page is one viewport of headline and the app is all cards and rows.
   So this is the one stylesheet that is really about reading — a single
   measured column, generous leading, and nothing in the margins to look
   at instead.

   Loaded after chrome.css and borrows its tokens, its body ground and
   its nav. THE PIECES, at the end, draws it in the my.adhd look. */

.legal-nav{margin-bottom:clamp(18px,4vh,36px)}

/* The reading measure, written once because the footer under the column has
   to land on the same edge. In rem and not in ch: `ch` resolves against each
   element's own font-size, and the footer's bottom row sets 12.5px — 68ch
   there came out 139px narrower than 68ch in the column above it, so the
   rule under the links started well inside them. 39.64rem is what 68ch of
   Baloo 2 measured at 16px, to a tenth of a pixel. */
:root{
  --legal-measure:39.64rem;
  /* The gutter, named because the track below has to subtract it: the
     measure is the width of the box the prose sat in when .legal was that
     box, gutter included, and the track is what is left inside it. */
  --legal-gutter:clamp(20px,5vw,40px);
}

.legal{
  /* main is never capped, at any width. It is <main> that carries the
     page's ground — chrome.css paints it --surface so the sticky footer
     has something opaque to be revealed from under — and a main narrower
     than the window leaves that footer showing down both sides of the
     page as two bands of the wrong colour, which is what every legal page
     was doing on any screen wider than its column. So the cap moves off
     the box painting the ground and onto a track inside it: main runs
     edge to edge, the reading measure is unchanged, and the reveal still
     has its lid. */
  display:grid;
  grid-template-columns:minmax(0, calc(var(--legal-measure) - var(--legal-gutter) * 2));
  justify-content:center;
  padding:0 var(--legal-gutter) clamp(60px,12vh,120px);
  padding-left:max(var(--legal-gutter), env(safe-area-inset-left, 0px));
  padding-right:max(var(--legal-gutter), env(safe-area-inset-right, 0px));
  font-size:16px;
  line-height:1.68;
}

.legal-title{
  color:var(--ink);
}
.legal-date{margin-top:8px; font-size:13px; color:var(--faint)}

.legal-lede{
  margin-top:22px; font-size:17.5px; line-height:1.6; color:var(--ink);
}

/* The summary. Anyone who reads one thing on this page reads this. */
/* Specificity bumped past the generic `.legal h2` below, which is an equal
   match and wins on order — this heading is a label on a box, not a
   section break, and must not carry the section break's air above it. */
.legal .legal-tldr h2{
  text-transform:uppercase; 
}
.legal-tldr ul{margin:0; padding:0; list-style:none}
.legal-tldr li{
  position:relative; line-height:1.55;
}
.legal-tldr li:first-child{margin-top:0}
.legal-tldr li::before{
  position:absolute; left:4px; top:.62em;
  width:7px; height:7px; border-radius:50%; background:var(--accent);
}
.legal-tldr strong{color:var(--ink); font-weight:700}

.legal h2{
  margin-top:clamp(34px,6vh,52px); margin-bottom:10px;
  font-size:21px; font-weight:800; letter-spacing:-.02em;
  line-height:1.25; color:var(--ink);
}

.legal p{margin-top:14px}
.legal p:first-of-type{margin-top:0}

.legal ul:not(.legal-tldr ul){margin-top:14px; padding-left:22px}
.legal ul:not(.legal-tldr ul) li{margin-top:9px}
.legal ul:not(.legal-tldr ul) li::marker{color:var(--faint)}

.legal strong{color:var(--ink); font-weight:650}

.legal code{
  font-family:ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size:.88em; 
  color:var(--ink); overflow-wrap:anywhere;
}

.legal a{
  text-decoration:underline;
  text-underline-offset:2px; text-decoration-thickness:1.5px;
  overflow-wrap:anywhere;   /* a long mailto must not push the column wide */
}
.legal a:hover{text-decoration-thickness:2.5px}

/* An aside rather than a clause: the plain-language warning that belongs
   next to the AI section without pretending to be part of the promise. */
.legal-note{
  margin-top:16px; padding:14px 16px;
  font-size:15px; 
}

.legal-back{
  margin-top:clamp(40px,8vh,72px); padding-top:24px;
  font-size:15px;
}
.legal-back a{text-decoration:none; font-weight:600}
.legal-back a:hover{text-decoration:underline}

/* privacy and terms: a quiet foot that stays on the legal pages rather
   than the landing page's band, which leads out to the website */
.legal-foot{
  max-width:var(--legal-measure); margin:0 auto;
  padding:22px var(--legal-gutter) calc(28px + env(safe-area-inset-bottom, 0px));
  display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:10px 20px;
  font-size:13.5px; 
}
.legal-foot-links{display:flex; flex-wrap:wrap; }
.legal-foot-links a{text-decoration:none; }

/* ---------- the wide layout ----------
   One measured column is right for a phone and wrong for a 1400px screen,
   where it leaves two thirds of the page empty and reads as an unfinished
   site rather than a considered one. So once there is room the page takes
   the width and spends it on a second column instead of on a longer line:
   the title and the summary box go left, the prose goes right.

   The breakpoint is 1160 and not 1000, which is where this started. Two
   columns need the sidebar's 26rem, the gap, and a line of prose still
   worth reading — under about 1150px there is not enough for all three,
   and what 1000 actually produced at 1024 was a 381px thread of prose
   beside a 512px summary box: the aside wider than the page it annotates.
   Below the breakpoint nothing here applies: .legal falls back to the one
   centred track it is declared with above, which is the phone's layout. */
@media (min-width:1160px){
  /* 26rem of sidebar, 50rem of prose, and the gap between them. Written
     as tokens because the footer has to land on the same two edges and
     the gap is not a constant — see --foot-measure at the bottom. On
     :root and not on .legal, because .site-foot is main's sibling and
     would inherit nothing declared on it. */
  :root{--legal-gap:clamp(40px,5vw,80px); --legal-shell:calc(76rem + var(--legal-gap))}

  .legal{
    /* One centred track becomes two. `justify-content:center` and the
       gutter are the base rule's and still apply; all that changes here
       is what sits between the gutters.

       Both tracks floor at 0 and cap at what they must never exceed, so
       the pair can only shrink to fit: there is no width at which this
       overflows and no sideways scrollbar to find. The sidebar reaches
       its 26rem first and every pixel after that goes to the prose, which
       is the right order — the summary box has a fixed amount to say and
       the prose is what the page is. */
    grid-template-columns:minmax(0,26rem) minmax(0,50rem);
    /* Centred and not spread is the reason the base rule's
       justify-content is left alone. `space-between` was here and it
       keeps pushing: on a 1920 monitor it left the two columns 560px
       apart, which is not one page with two columns, it is two pages.
       Centred, the slack collects outside the pair once both tracks have
       reached their cap, which is a margin rather than a canyon. */
    column-gap:var(--legal-gap);
    align-items:start;
  }
  .legal-head{grid-column:1; grid-row:1}
  .legal-lede{grid-column:2; grid-row:1; margin-top:0}
  /* The one block worth keeping on screen while the prose scrolls past it:
     it is the summary of everything to the right of it. */
  .legal-tldr{
    grid-column:1; grid-row:2;
    top:clamp(20px,4vh,40px);
  }
  .legal-body{grid-column:2; grid-row:2}
  /* The first heading in column two starts a row, not a section — the air
     a section break carries would drop it below the box beside it. */

  /* The footer follows the page it ends, on the same edges. --foot-measure
     is the outer box including the gutter the band has already spent, so
     the gutter goes back on here and comes off again in chrome.css. The
     gap is inside the shell rather than added to a constant because it is
     a clamp: hard-code 80 and the two disagree by a few pixels at every
     width between 1160 and 1600, which is exactly where a rule that does
     not line up with the column above it is visible. With the width back,
     so is the brand-beside-links arrangement the narrow column gave up. */
    }

/* ============ THE PIECES ============
   The look (BRAND.md §5). The title is a white
   piece with the date as a chip; the short version is a run of pieces in
   the quiet fills, ending on an ink one; the body is one white piece with
   a dashed rule between sections, and the Malay notice an inset of its
   own. The pages have no wrapper per section, so the body stays one piece
   rather than gain markup. */

/* A piece's own day (see chrome.css). */
.legal-head, .legal-tldr li, .legal-body, .legal-foot-links a{
  --ink:var(--black); --ink-soft:var(--navy); --muted:var(--stone); --faint:#6B6B7A;
  --line:#E4E2F5; --line-strong:#CFCBE9; --accent:var(--blue); --wash:#F4F3FE;
  --b-focus:var(--blue);
  color:var(--ink);
}
.legal{color:var(--b-muted)}
.legal-nav{position:relative}

.legal-head, .legal-tldr li, .legal-body{
  background:var(--p-white);
  border:var(--b-stroke) solid var(--b-line);
  border-radius:var(--b-radius);
  box-shadow:var(--b-lift) var(--b-lift) 0 var(--b-shadow);
}
.legal-head{padding:clamp(20px,3.4vw,32px); box-shadow:var(--b-lift-lg) var(--b-lift-lg) 0 var(--b-shadow)}
.legal-title{font-size:clamp(40px,6.4vw,72px); font-weight:800; letter-spacing:-.03em; line-height:1}
.legal p.legal-date{
  display:inline-block; margin-top:14px;
  padding:4px 12px; background:var(--p-wash); color:var(--ink);
  border:var(--b-stroke-thin) solid var(--b-line); border-radius:var(--b-pill);
  font-family:var(--mono); font-size:13px;
}
.legal p.legal-lede{margin-top:24px; color:var(--ink); font-size:clamp(17.5px,1.6vw,20px)}

/* The short version: a run of pieces, the last in ink. */
.legal-tldr{
  margin-top:clamp(28px,4vh,44px); padding:0;
  background:none; border:0; border-radius:0;
}
.legal .legal-tldr h2{
  margin:0 0 14px; font-family:var(--display); font-size:15px; font-weight:700;
  letter-spacing:.06em; color:var(--ink);
}
.legal-tldr ul{display:grid; gap:16px}
.legal-tldr li{margin-top:0; padding:16px 18px; color:var(--ink-soft)}
.legal-tldr li::before{content:none}
.legal-tldr li:nth-child(4n+1){background:var(--p-pale)}
.legal-tldr li:nth-child(4n+2){background:var(--p-violet-pale)}
.legal-tldr li:last-child:not(:first-child){
  background:var(--p-ink); color:var(--p-on-dark);
  box-shadow:var(--b-lift) var(--b-lift) 0 var(--b-shadow-ink);
}
.legal-tldr li:last-child:not(:first-child) strong{color:var(--p-on-dark)}

/* The body: one white piece, sections parted by a dashed rule. */
.legal-body{margin-top:clamp(28px,4vh,44px); padding:clamp(20px,3.6vw,40px)}
.legal-body > :first-child{margin-top:0}
.legal-body, .legal-body p{color:var(--muted)}
.legal-body h2{font-size:clamp(22px,2.4vw,28px); font-weight:800; letter-spacing:-.025em}
.legal-body > h2:not(:first-child){
  margin-top:clamp(28px,4vh,40px); padding-top:clamp(24px,3.4vh,34px);
  border-top:var(--b-stroke-thin) dashed var(--b-line);
}
.legal-body > div[lang="ms"]{
  margin-top:14px; padding:clamp(16px,2.6vw,24px);
  background:var(--p-violet-pale); color:var(--navy);
  border:var(--b-stroke-thin) solid var(--b-line); border-radius:var(--b-radius);
}
.legal-body > div[lang="ms"] p, .legal-body > div[lang="ms"] li{color:var(--navy)}
.legal-note{
  border:var(--b-stroke-thin) solid var(--b-line); border-radius:var(--b-radius);
  background:var(--p-wash); color:var(--ink-soft);
}
.legal code{border-radius:var(--b-pill); padding:1px 8px; background:var(--p-wash); border:1px solid var(--b-line)}
.legal a{color:var(--accent)}
.legal-back{border-top:var(--b-stroke-thin) dashed var(--b-line)}

/* The foot: the two pages and the address as capsules, this one in ink. */
.legal-foot{border-top:0; padding-top:clamp(28px,5vh,44px); color:var(--b-muted)}
.legal-foot-links{gap:10px}
.legal-foot-links a{
  display:inline-flex; align-items:center; min-height:44px; padding:0 18px;
  background:var(--p-white); color:var(--ink);
  border:var(--b-stroke) solid var(--b-line); border-radius:var(--b-pill);
  font-weight:700;
}
.legal-foot-links a{box-shadow:var(--b-lift-sm) var(--b-lift-sm) 0 var(--b-shadow)}
.legal-foot-links a:hover{background:var(--p-wash); color:var(--ink)}
.legal-foot-links a[aria-current="page"]{
  background:var(--p-ink); color:var(--p-on-dark);
  box-shadow:var(--b-lift-sm) var(--b-lift-sm) 0 var(--b-shadow-ink);
}

@media (min-width:1160px){
  /* Five pieces are taller than a screen; a sticky column would hide the
     last of them, so it scrolls with the page. */
  .legal-tldr{position:static}
  .legal p.legal-lede{align-self:center; margin-top:0}
  .legal-foot{max-width:calc(var(--legal-shell) + var(--legal-gutter) * 2)}
}

/* ============ NESTED CORNERS ============
   BRAND.md §5: a shape that sits in a piece's corner takes the piece's
   radius minus the gap between their edges (the piece's outline plus its
   padding), down to square, so the two curves run parallel. Each gap below
   repeats the padding of the rule it names; change one, change both.
   Where the gaps differ, the larger one counts. Free-standing capsules and
   circles (chips, small buttons, icon discs) keep their own shape. */
/* The Malay text and the notes sit at least 20px in (.legal-body). */
.legal-body > div[lang="ms"], .legal-body .legal-note{
  border-radius:max(0px, calc(var(--b-radius) - var(--b-stroke) - 20px));
}
