/* ===========================================================================
   CALM — three kinds of box (round 171)

   The older chapters grew a bespoke box for every block: 18 styles on the diet
   chapter alone, boxes inside boxes, and nearly the whole page inside one. When
   everything is highlighted nothing is. This sheet gives a box one of three
   meanings, the same everywhere, and turns the rest back into plain sections.

     .c-key   Key point   the thing to do or remember        blue, tinted
     .c-warn  Caution     safety and drug interactions only  red, tinted
     .c-note  Note        method, evidence detail, caveats   quiet, left rule

   and two that remove a box:

     .c-sec   a whole section that used to be wrapped in a box: now a plain
              section with an ordinary heading
     .c-plain a small block that used to be boxed: now ordinary text

   A content file opts in by adding the role class beside the legacy class
   (class="fish-panel c-sec"). The legacy class still supplies any layout
   inside the block; this sheet only decides whether it is a box and which.
   The looks match the three the newer chapters already use (.ess-flag-calm,
   .ess-flag, .ess-note), so the two generations of page read as one site.

   Colour policy (docs/CONTENT-MODEL.md): pale tint or surface, accent border,
   text from tokens that flip with the theme. Nothing here is light-on-colour.

   Selectors double the role class (.c-sec.c-sec) on purpose: the legacy rules
   they replace are up to three classes deep, and this must win without
   !important so print.css and the themes still can.
   ======================================================================== */

/* ---- sections: no box -------------------------------------------------- */
.topic-body .c-sec.c-sec,
.topic-body .c-plain.c-plain{background:none;border:0;border-radius:0;box-shadow:none;padding:0}
.topic-body .c-sec.c-sec::before,.topic-body .c-sec.c-sec::after{content:none}
.topic-body .c-sec.c-sec{margin:44px 0 0}
.topic-body .container > .c-sec.c-sec{margin-top:48px;padding-top:38px;border-top:1px solid var(--line)}
.topic-body .container > .c-sec.c-sec:first-child,
.topic-body .container > .section-head:first-child + .c-sec.c-sec{margin-top:0;padding-top:0;border-top:0}
.topic-body .c-sec.c-sec .c-sec.c-sec{margin-top:36px;padding-top:0;border-top:0}
.topic-body .c-plain.c-plain{margin:16px 0}
.topic-body .c-sec.c-sec > .c-sec.c-sec:first-child{margin-top:0}

.topic-body .c-sec.c-sec > :is(h3,h4,h5,h6){font-family:var(--f-ui);font-weight:600;line-height:1.25;
  color:var(--ink);background:none;border:0;padding:0;margin:34px 0 14px;letter-spacing:0;text-transform:none}
.topic-body .c-sec.c-sec > :is(h3,h4,h5,h6):first-child{margin-top:0}
.topic-body .c-sec.c-sec > h3{font-size:25px}
.topic-body .c-sec.c-sec > h4{font-size:21.5px}
.topic-body .c-sec.c-sec > h5{font-size:18.5px}
.topic-body .c-sec.c-sec > h6{font-size:17px}
/* A heading one wrapper down (the guide's "Essential blood tests" panel head). */
.topic-body .tests-panel.c-sec .tests-panel-head h3{font-size:25px;line-height:1.25;color:var(--ink)}
.topic-body .c-plain.c-plain > :is(h4,h5,h6){font-family:var(--f-ui);font-size:16.5px;font-weight:600;line-height:1.3;
  color:var(--ink);letter-spacing:0;text-transform:none;margin:0 0 8px}

/* ---- the three boxes ---------------------------------------------------- */
.topic-body .c-key.c-key,
.topic-body .c-warn.c-warn{border-radius:0;box-shadow:none;padding:16px 20px;margin:22px 0;
  font-size:15.5px;line-height:1.62;color:var(--ink-2)}
.topic-body .c-key.c-key{background:var(--ultra-pale);border:1px solid var(--ultra-line);border-left:4px solid var(--ultra)}
.topic-body .c-warn.c-warn{background:var(--hi-bg);border:1px solid var(--hi);border-left:4px solid var(--hi)}
.topic-body .c-note.c-note{background:none;border:0;border-left:2px solid var(--line-2);border-radius:0;box-shadow:none;
  padding:2px 0 2px 16px;margin:18px 0;font-size:15px;line-height:1.62;color:var(--ink-3);font-style:normal}

.topic-body :is(.c-key,.c-warn,.c-note) > :is(h3,h4,h5,h6){font-family:var(--f-ui);font-size:16px;font-weight:600;
  line-height:1.3;letter-spacing:0;text-transform:none;background:none;border:0;padding:0;margin:0 0 7px}
.topic-body .c-key > :is(h3,h4,h5,h6){color:var(--ultra)}
.topic-body .c-warn > :is(h3,h4,h5,h6){color:var(--hi)}
.topic-body .c-note > :is(h3,h4,h5,h6){color:var(--ink-2)}
.topic-body :is(.c-key,.c-warn,.c-note) :is(p,li){font-size:inherit;line-height:inherit;color:inherit}
.topic-body :is(.c-key,.c-warn,.c-note) > :last-child{margin-bottom:0}
.topic-body :is(.c-key,.c-warn,.c-note) > p:last-child{margin-bottom:0}
.topic-body .c-key.c-key strong{color:var(--ink)}
.topic-body .c-warn.c-warn strong{color:var(--ink)}
/* A note is the quiet register: its bold stays bold but does not jump out. */
.topic-body .c-note.c-note :is(strong,b){color:var(--ink-2);font-weight:600}

/* No box directly inside a box: the inner one becomes a note. */
.topic-body :is(.c-key,.c-warn) :is(.c-key,.c-warn){background:none;border:0;border-left:2px solid var(--line-2);
  padding:2px 0 2px 16px;margin:14px 0}

/* ---- repairs found while measuring ------------------------------------- */
/* Diet chapter, "eat regularly" / "limit": the label was a flex item of its
   own, so every row broke into ragged columns of a different width. */
.topic-body .diet-col .group-list li{display:block}
.topic-body .diet-col .group-list li strong{display:inline}
/* Glucose-monitoring chapter, sensor comparison: the recommended sensor's
   "buy direct" link was dark blue text on a green fill (contrast 1.5:1), and
   every buy link turned blue-on-blue on hover, because theme-fixes.css forces
   link colour inside the table. Outline instead of fill, per the colour policy. */
.topic-body .cgm-compare .cell-buy:hover{background:var(--ultra-pale);transform:none}
.topic-body .cgm-compare td.col-pick .cell-buy,
.topic-body .cgm-compare td.col-pick .cell-buy:hover{background:var(--surface);border-color:var(--ok)}

@media (max-width:640px){
  .topic-body .container > .c-sec.c-sec{margin-top:38px;padding-top:30px}
  .topic-body .c-sec.c-sec > h3{font-size:22.5px}
  .topic-body .c-sec.c-sec > h4{font-size:20px}
  .topic-body .c-sec.c-sec > h5{font-size:18px}
  .topic-body .c-key.c-key,.topic-body .c-warn.c-warn{padding:14px 16px}
}

/* ===========================================================================
   ANSWER FIRST, DETAIL ON DEMAND (option 1 trial, round 172)
   .in-short is in the content file. The rest is built by assets/js/fold.js
   from data-fold attributes; without the script the chapter is simply open.
   Sections fold to rows between hairlines, not to boxes: a box round a whole
   section is what the top of this sheet removes.
   ======================================================================== */
.topic-body .in-short{background:var(--surface);border:1px solid var(--line);border-top:3px solid var(--ultra);
  padding:18px 22px 20px;margin:0 0 26px}
.topic-body .in-short-lab{font-family:var(--f-data);font-size:14px;font-weight:500;letter-spacing:.13em;
  text-transform:uppercase;color:var(--ultra);margin:0 0 11px}
.topic-body .in-short ul{margin:0;padding-left:21px;display:grid;gap:10px}
.topic-body .in-short li{font-size:17px;line-height:1.55;color:var(--ink);margin:0}
.topic-body .in-short li a{font-family:var(--f-ui);font-size:14.5px;font-weight:500;white-space:nowrap;margin-left:4px}
.topic-body .in-short li a::after{content:" \2193"}

.topic-body .fold-bar{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:34px 0 12px}
.topic-body .fold-bar-lab{font-family:var(--f-data);font-size:14px;font-weight:500;letter-spacing:.13em;
  text-transform:uppercase;color:var(--ink-3);margin:0 auto 0 0}
.topic-body .fold-btn{font-family:var(--f-ui);font-size:14.5px;font-weight:500;line-height:1.2;color:var(--ink);
  background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-sm);padding:9px 14px;cursor:pointer}
.topic-body .fold-btn:hover{border-color:var(--ultra)}
.topic-body .fold-btn:focus-visible{outline:2px solid var(--ultra);outline-offset:2px}

.topic-body details.fold{border-top:1px solid var(--line-2);margin:0;scroll-margin-top:76px}
.topic-body details.fold > summary{display:block;list-style:none;cursor:pointer;position:relative;padding:17px 46px 17px 0}
.topic-body details.fold > summary::-webkit-details-marker{display:none}
.topic-body details.fold > summary::after{content:"+";position:absolute;right:8px;top:14px;
  font-family:var(--f-ui);font-size:26px;line-height:1;color:var(--ink-3)}
.topic-body details.fold[open] > summary::after{content:"\2212"}
.topic-body details.fold > summary:hover .fold-t{color:var(--ultra)}
.topic-body details.fold > summary:focus-visible{outline:2px solid var(--ultra);outline-offset:2px}
.topic-body details.fold > summary .fold-t{font-family:var(--f-ui);font-size:19px;font-weight:600;line-height:1.3;
  letter-spacing:0;text-transform:none;color:var(--ink);background:none;border:0;padding:0;margin:0;scroll-margin-top:76px}
.topic-body .fold-g{display:block;font-family:var(--f-ui);font-size:15px;line-height:1.45;color:var(--ink-3);margin-top:4px}
.topic-body .fold-b{padding:6px 0 34px}
.topic-body .fold-b > .c-sec.c-sec{margin-top:0;padding-top:0;border-top:0}
.topic-body .fold-b > :first-child{margin-top:0}
/* A whole column folded (the last section of a chapter): it closes the list. */
.topic-body .container.fold-col{margin-top:0;padding-top:0}
.topic-body .container.fold-col > details.fold{border-bottom:1px solid var(--line-2)}

.topic-body details.fold-note{margin:16px 0}
.topic-body details.fold-note > summary{cursor:pointer;font-family:var(--f-ui);font-size:15px;font-weight:500;color:var(--ink-2)}
.topic-body details.fold-note > summary:hover{color:var(--ultra)}
.topic-body details.fold-note > summary:focus-visible{outline:2px solid var(--ultra);outline-offset:2px}
.topic-body details.fold-note > .c-note.c-note{margin-top:10px}
.topic-body .sugar-method{font-size:14px;line-height:1.6;color:var(--ink-3);margin:10px 0 0}

@media (max-width:640px){
  .topic-body .in-short{padding:16px 17px 18px}
  .topic-body .in-short li{font-size:16.5px}
  .topic-body details.fold > summary{padding:15px 40px 15px 0}
  .topic-body details.fold > summary .fold-t{font-size:18px}
}
