/* The care reports' newer parts: the day timeline (client/care-day.js, "dy-") and what the week grid and day table gained
   (client/care-week.js, "wk-"; the weekly summary's own rules stay in styles.css). Linked after /styles.css. Plain CSS an
   iPhone on iOS 15.0 reads: custom properties and gradients, no :has() or color-mix(). */

/* ===== one set of kind colours ===== */
/* Each kind's colour, as a shade white text passes 4.5:1 on (the contrast is in the comment). The log buttons (.k-* in
   app.html and styles.css) and the month's badges (.mo-c i.k-*) read these, so a kind has one colour everywhere. */
:root {
  --k-nap: #5E4BA8;     /* 6.9 */
  --k-feed: #A35A12;    /* 5.2: bottle, nursing, solids */
  --k-diaper: #2F6E96;  /* 5.5 */
  --k-potty: #1F5F7A;   /* 7.1 */
  --k-pump: #8A4F9E;    /* 5.7 */
  --k-act: #7A6200;     /* 5.9 */
  --k-med: #B4462E;     /* 5.5 */
  --k-temp: #A5501A;    /* 5.6 */
  --k-growth: #4A6E25;  /* 5.9 */
  --k-mood: #C4405E;    /* 5.0 */
  --k-meal: #3F7A57;    /* 5.1 */
  --k-outing: #1F746F;  /* 5.6 */
  --k-note: #625A73;    /* 6.5 */
}

/* ===== the day timeline ===== */
/* One row an hour, starting at the child's day start. A bar is positioned by percent of the whole plot, so it keeps its
   place at any width; its words sit inside it, so colour is never the only signal. */
.dy { --dy-h: 44px; }
.dy .chips { margin-bottom: 4px; }
.dy-tiles { margin: 8px 0 14px; }
/* What the day has from before its first hour: a band of its own above the grid, washed like the night. */
.dy-before { margin: 0 0 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(91, 58, 140, .12); }
.dy-before-h { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.dy-band { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.dy-before .dy-b { position: relative; min-height: 28px; }
.dy-before .dy-w { white-space: normal; }
.dy-nowband { margin: 6px 0 0; }
.dy-nowband b { display: inline-block; padding: 0 8px; border-radius: 99px; background: var(--plum); color: #fff; font-size: 11px; line-height: 18px; }
.dy-grid { display: grid; grid-template-columns: 52px minmax(0, 1fr); }
.dy-hours .dy-h { display: block; height: var(--dy-h); box-sizing: border-box; padding: 3px 6px 0 0; font-size: 11px; line-height: 14px; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dy-plot { position: relative; height: calc(var(--dy-h) * 24); box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background-color: var(--surface);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent var(--dy-h)); }
/* The night, by the child's hours: a plum wash the hour lines show through (the key under the grid says it in words). */
.dy-shade { position: absolute; left: 0; right: 0; background: rgba(91, 58, 140, .12); pointer-events: none; }
.dy-list { position: absolute; top: 0; bottom: 0; left: 4px; right: 4px; margin: 0; padding: 0; list-style: none; }
.dy-b { --k: var(--ink-soft); --kt: var(--bg); position: absolute; box-sizing: border-box; min-height: 24px; margin: 0; padding: 2px 6px; display: flex; align-items: flex-start;
  overflow: hidden; border: 1px solid var(--k); border-left-width: 5px; border-radius: 8px; background: var(--kt); color: var(--ink); font-size: 12px; line-height: 18px; z-index: 1; }
.dy-pill { align-items: center; border-radius: 99px; padding-top: 0; padding-bottom: 0; }
.dy-w { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
/* A tall bar has room to wrap its words (the short ones keep to a line and end in an ellipsis). */
.dy-tall .dy-w { white-space: normal; overflow-wrap: anywhere; }
/* The words a screen reader gets: the whole entry, in time order (the grid is a list). */
.dy-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* A kind's stripe is its colour above; the body is a light tint of it, with ink text (12:1 or more on every tint). */
.dy-k-nap { --k: var(--k-nap); --kt: #ECE5F6; }
.dy-k-feed { --k: var(--k-feed); --kt: #FCEBD7; }
.dy-k-diaper { --k: var(--k-diaper); --kt: #DFEDF6; }
.dy-k-potty { --k: var(--k-potty); --kt: #D5EBF1; }
.dy-k-pump { --k: var(--k-pump); --kt: #F1E4F5; }
.dy-k-act { --k: var(--k-act); --kt: #F4EDCB; }
.dy-k-med { --k: var(--k-med); --kt: #F9E1DB; }
.dy-k-temp { --k: var(--k-temp); --kt: #F8E6D8; }
.dy-k-growth { --k: var(--k-growth); --kt: #E2EED6; }
.dy-k-mood { --k: var(--k-mood); --kt: #FBE6EB; }
.dy-k-meal { --k: var(--k-meal); --kt: #DDEEE3; }
.dy-k-outing { --k: var(--k-outing); --kt: #D8EEEC; }
.dy-k-note { --k: var(--k-note); --kt: #EEF3EC; }
/* Night sleep: dark, so it reads as the night even at a glance. */
.dy-night { --k: #2A2140; --kt: #3B2F63; color: #fff; }
/* Still going: dashed all round, on the plain page. */
.dy-run { border-style: dashed; background: var(--surface); }
.dy-night.dy-run { background: #3B2F63; border-color: var(--plum); }
/* Cut at the grid's end: the rest is past the day start. */
.dy-cut { border-bottom-style: dotted; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.dy-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--plum); z-index: 3; pointer-events: none; }
.dy-now b { position: absolute; right: 0; top: -10px; padding: 0 8px; border-radius: 99px 0 0 99px; background: var(--plum); color: #fff; font-size: 11px; line-height: 18px; }
.dy-key { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 14px; color: var(--ink-soft); }
.dy-sw { flex: none; width: 14px; height: 14px; box-sizing: border-box; border-radius: 3px; background: rgba(91, 58, 140, .12); border: 1px solid rgba(91, 58, 140, .55); }
.dy-page .link-btn { min-height: 44px; }
.dy-title:focus { outline: none; }
.mo-detail .dy { margin-top: 4px; }

/* ===== the week: every kind on the grid, and a day's name as a button ===== */
.wk-legend { flex-wrap: wrap; gap: 6px 16px; }
/* A taller grid than the weekly summary's, so the marks (each with its letter) have room. */
.wk-tl .wk-track { height: 264px; }
/* Night sleep is hatched where day sleep is solid (the weekly summary gives bottles the marigold hatching). */
.wk-nap.wk-night { background: repeating-linear-gradient(135deg, var(--plum) 0 3px, #2A2140 3px 6px); }
.wk-c-nap { background: var(--k-nap); } .wk-c-feed { background: var(--k-feed); } .wk-c-diaper { background: var(--k-diaper); } .wk-c-potty { background: var(--k-potty); }
.wk-c-pump { background: var(--k-pump); } .wk-c-act { background: var(--k-act); } .wk-c-med { background: var(--k-med); } .wk-c-temp { background: var(--k-temp); }
.wk-c-growth { background: var(--k-growth); } .wk-c-mood { background: var(--k-mood); } .wk-c-meal { background: var(--k-meal); }
.wk-c-outing { background: var(--k-outing); } .wk-c-note { background: var(--k-note); }
/* A mark is a dot or a square in the kind's colour with the kind's letter in it, white on the colour (4.5:1 or more); the
   legend's swatches are the same marks in the flow. */
.wk-mk { position: absolute; z-index: 2; box-sizing: border-box; width: 14px; height: 14px; margin: -7px 0 0 -7px; display: grid; place-items: center; box-shadow: 0 0 0 1.5px var(--surface);
  color: #fff; font: normal 700 9px/1 var(--sans); }
.wk-mk.wk-lg { position: static; margin: 0; width: 16px; height: 16px; font-size: 10px; box-shadow: none; }
.wk-sh-dot { border-radius: 50%; }
.wk-sh-sq { border-radius: 3px; }
/* A timed entry that isn't sleep sits on the middle of the column, over any sleep block; one carried past midnight has a flat top. */
.wk-over { left: 34%; right: 34%; z-index: 1; box-shadow: 0 0 0 1.5px var(--surface); }
.wk-tail { border-top-left-radius: 0; border-top-right-radius: 0; }
.wk-blk.wk-run { background: transparent; }
.wk-daybtn { min-height: 44px; padding: 0; border: 0; background: none; color: var(--plum); font: inherit; font-weight: 700; text-align: left; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.wk-table td small + small { margin-top: 2px; }

/* ===== long names ===== */
/* A child's name with nowhere to break (a long one, a hyphenated double name) wraps inside its chip (the views' child
   chips, quick entry's, the log sheet's), the live strip, the week card's title and the report's heading instead of
   pushing the page sideways at 320px. word-break: break-word for iOS 15.0 (overflow-wrap: anywhere is Safari 15.4);
   kept off the report's tables, which scroll sideways rather than squeeze their numbers. */
.chip, .live-name, .wk-head b, .cr-page .cr-meta { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.wk-head b { min-width: 0; }

/* ===== the pediatrician report's care insights (client/care-report.js, report-insights.js, report-charts.js,
   report-entries.js) ===== */
.cr-sum { margin: 4px 0; padding-left: 20px; font-size: 15px; line-height: 1.45; }
.cr-sum li + li { margin-top: 4px; }
/* The charts: bars with their number above and their day below, in ink on white whatever the theme (the page is paper). */
.cr-charts { display: grid; gap: 12px; }
.cr-fig { margin: 0; break-inside: avoid; }
.cr-chart { display: block; width: 100%; height: auto; max-width: 520px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cr-chart text { font-family: var(--sans); text-anchor: middle; }
.cr-cv { font-size: 10px; font-weight: 700; fill: #111; font-variant-numeric: tabular-nums; }
.cr-cd { font-size: 10px; fill: #444; }
.cr-base { stroke: #888; stroke-width: 1; }
/* Night sleep dark, day sleep a light tint with an outline: told apart by lightness in black and white. */
.cr-bar-night { fill: var(--k-nap); }
.cr-bar-day { fill: #ECE5F6; stroke: var(--k-nap); stroke-width: 1; }
.cr-bar-feed { fill: var(--k-feed); }
.cr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; font-size: 13px; color: #444; }
.cr-key { display: inline-flex; align-items: center; gap: 5px; }
.cr-key svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Every entry: closed by default, its summary a 44px target. */
.cr-every summary { min-height: 44px; display: flex; align-items: center; color: var(--plum); font-weight: 700; font-size: 15px; cursor: pointer; }
.cr-every summary:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }
.cr-page .cr-day { margin: 10px 0 2px; font: 700 14px/1.3 var(--sans); }
.cr-list { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.4; }
.cr-list li { padding: 4px 0; border-bottom: 1px solid #ccc; overflow-wrap: break-word; word-break: break-word; }
.cr-list b { font-variant-numeric: tabular-nums; }
/* The patterns: each label over its value, both left-aligned, so a long value ("6 hrs 50 min, night of Sat, Nov 28")
   reads on one line at 390px. */
.cr-stats.cr-pat div { display: block; }
.cr-stats.cr-pat dt { font-size: 13px; color: #444; }
.cr-stats.cr-pat dd { text-align: left; }
/* The trend's four columns fit 320px by wrapping, rather than scrolling the change out of sight. */
.cr-trend th[scope=row] { white-space: normal; }
.cr-trend th, .cr-trend td { padding-right: 6px; }
.cr-every-pick { margin-top: 8px; }
.cr-every-pick .hint { display: block; margin: 0; }
@media print {
  html.cr-printing .cr-every:not([open]), html.cr-printing .cr-shut { display: none; }
  html.cr-printing .cr-every summary { display: none; }
  html.cr-printing .cr-list li { break-inside: avoid; font-size: 10pt; }
  html.cr-printing .cr-sum { font-size: 11pt; }
  /* Paper is wide: the two charts side by side, so they take a third of a page, not most of one. */
  html.cr-printing .cr-charts { grid-template-columns: 1fr 1fr; }
}
