/* Health Law: "Patient Chart".
   A clinical chart: white and pale mint, one teal, a humanist sans with monospaced chart labels,
   a heartbeat line under the masthead, vital-sign counters, case cards laid out like a chart,
   and red "dated" flags for law that may change soon. Loaded after study.css. */

:root {
  --paper: #f4f8f7; --ink: #163236; --ink-2: #2c4b4f; --muted: #5d7a7e;
  --rule: #0f7a74; --hair: #cfe0dd; --tint: #e6f0ee; --accent: #0f7a74;
  --ok: #1d6b45; --warn: #b3261e; --link: #0b5f5a;
  --card: #ffffff; --teal: #0f7a74; --teal-2: #13948c; --flag-bg: #fdecea; --flag: #b3261e;
  --sans: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1a1b; --ink: #e2efed; --ink-2: #c3d6d3; --muted: #8fa9a6;
    --rule: #3cc2b7; --hair: #23393a; --tint: #142627; --accent: #3cc2b7;
    --ok: #7fd1a6; --warn: #ff8f86; --link: #7fdcd3;
    --card: #122324; --teal: #3cc2b7; --teal-2: #3cc2b7; --flag-bg: #3a1c1a; --flag: #ff8f86;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1a1b; --ink: #e2efed; --ink-2: #c3d6d3; --muted: #8fa9a6;
  --rule: #3cc2b7; --hair: #23393a; --tint: #142627; --accent: #3cc2b7;
  --ok: #7fd1a6; --warn: #ff8f86; --link: #7fdcd3;
  --card: #122324; --teal: #3cc2b7; --teal-2: #3cc2b7; --flag-bg: #3a1c1a; --flag: #ff8f86;
}

body { font: 17px/1.6 var(--sans); }
a { color: var(--link); }

/* ---------- frame: a white chart header with a heartbeat line under it ---------- */
.top { max-width: none; background: var(--card); border-bottom: 1px solid var(--hair);
       padding-left: max(16px, calc((100vw - var(--wide)) / 2 + 16px));
       padding-right: max(16px, calc((100vw - var(--wide)) / 2 + 16px)); position: relative; margin-bottom: 34px; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -31px; height: 30px; background: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 30' preserveAspectRatio='none'%3E%3Cpolyline fill='none' stroke='%230f7a74' stroke-width='2' vector-effect='non-scaling-stroke' points='0,18 250,18 262,18 268,5 275,28 282,2 289,23 296,18 600,18'/%3E%3C/svg%3E");
  background-size: 600px 30px; background-repeat: repeat-x; border-bottom: 1px solid var(--hair); }
.brand { color: var(--ink); font: 700 1.2rem/1.2 var(--sans); letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 10px; }
.brand .mark { width: 22px; height: 22px; border-radius: 5px; background: var(--teal); position: relative; transform: none; }
.brand .mark::before, .brand .mark::after { content: ""; position: absolute; background: #fff; }
.brand .mark::before { left: 9px; top: 4px; width: 4px; height: 14px; }
.brand .mark::after { left: 4px; top: 9px; width: 14px; height: 4px; }
.top nav a, .top .aside a { color: var(--ink-2); font-weight: 600; }
.top nav a[aria-current="page"] { border-bottom-color: var(--teal); color: var(--teal); }
.top .aside .cta { background: var(--teal); color: #fff; padding: 6px 14px; border-radius: 6px; text-decoration: none; }
.foot { border-top: 1px solid var(--hair); color: var(--muted); }

/* ---------- type ---------- */
h1 { font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
h2 { font-weight: 700; letter-spacing: -.01em; border-top: 0; color: var(--ink); }
main > section > h2:first-child::before, main > h2::before { content: none; }
main > section > h2:first-child { border-left: 4px solid var(--teal); padding-left: 12px; border-top: 0; }
h3 { color: var(--ink-2); }
.kicker { font: 600 .72rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.kicker b { color: var(--teal); }
.lede { color: var(--ink-2); }
.meta { color: var(--muted); }
.button, button { background: var(--teal); color: #fff; border: 0; border-radius: 6px; font-weight: 600; }
.button:hover, button:hover { background: var(--teal-2); color: #fff; }
button.quiet { background: transparent; color: var(--teal); border: 1px solid var(--hair); }
textarea, select, input { border: 1px solid var(--hair); border-radius: 6px; background: var(--card); color: var(--ink); }

/* ---------- vital-sign counters ---------- */
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 10px; border: 0; }
.facts-grid > div { background: var(--card); border: 1px solid var(--hair); border-left: 4px solid var(--teal); border-radius: 6px; padding: 8px 12px; }
.facts-grid dt { font: 600 .68rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); order: 2; }
.facts-grid dd { font: 600 1.02rem/1.35 var(--sans); color: var(--ink); margin: 0; overflow-wrap: anywhere; }
.chart-hero .facts-grid dd { font: 700 1.5rem/1.2 var(--mono); color: var(--teal); }

/* ---------- chart cards: the home page case chart, worked problems, the free gate ---------- */
.chart { background: var(--card); border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; margin: 24px 0; }
.chart .hd { background: var(--teal); color: #fff; padding: 9px 16px; display: flex; justify-content: space-between; gap: 12px;
             font: 600 .74rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.chart .row { display: grid; grid-template-columns: 8.5rem 1fr; gap: 12px; border-bottom: 1px solid var(--tint); padding: 9px 16px; font-size: .95rem; }
.chart .row:last-child { border-bottom: 0; }
.chart .k { font: 600 .7rem/1.6 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.flag { display: inline-block; background: var(--flag-bg); color: var(--flag); font: 700 .72rem/1.2 var(--sans);
        padding: 3px 8px; border-radius: 10px; letter-spacing: .02em; }
.chart-hero { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) { main > .chart-hero { grid-column: 1 / -1; grid-template-columns: 1.15fr 1fr; } .chart-hero .chart { margin-top: 6px; } }
.chart-hero .chart .row { grid-template-columns: 6.5rem 1fr; }

.watch { list-style: none; padding: 0; margin: 0; }
.watch li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.watch li:last-child { border-bottom: 0; }
.watch .when { font: 600 .74rem/1.6 var(--mono); color: var(--flag); text-transform: uppercase; }

.problem { background: var(--card); border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; padding: 0 0 12px; margin: 18px 0; }
.problem header { background: var(--tint); padding: 8px 16px; font: 600 .74rem/1.4 var(--mono); text-transform: uppercase;
                  letter-spacing: .06em; color: var(--ink-2); border-bottom: 1px solid var(--hair); display: flex; gap: 12px; flex-wrap: wrap; }
.problem .no { color: var(--teal); }
.problem .lvl { background: var(--card); border: 1px solid var(--hair); border-radius: 10px; padding: 0 8px; }
.problem .lvl.l3 { color: var(--flag); border-color: var(--flag); }
.problem .grant, .problem .ask, .problem form, .problem details { margin-left: 16px; margin-right: 16px; }
.problem .ask { font-weight: 600; }
.problem details summary { color: var(--teal); font-weight: 600; cursor: pointer; }
.problem .answer { border-left: 3px solid var(--teal); padding-left: 12px; }
.problem .steps li::marker { color: var(--teal); font-family: var(--mono); }

.gate { background: var(--card); border: 1px solid var(--hair); border-top: 4px solid var(--teal); border-radius: 10px; padding: 16px 20px; }
.badge { background: var(--tint); color: var(--teal); border-radius: 10px; }
.opara:target { background: var(--tint); }
ul.cases li, ol.cases li { border-bottom-color: var(--hair); }

@media (max-width: 600px) {
  .chart .row, .watch li { grid-template-columns: 1fr; gap: 2px; }
  .top::after { background-size: 400px 30px; }
}
@media print { .top::after { display: none; } .chart, .problem { break-inside: avoid; } }
