/* The viewer's own styles, on top of the site's common.css. The flow scale (--f1..--f4) steps in
   lightness, so it reads without telling red from green; the heat map is one blue, light to dark. */
:root {
  --f1: #f1d3cc; --f2: #d4877a; --f3: #a8463a; --f4: #33100b; --nr: #f7f8f9; --nr-ink: #c3cad2;
  --h1: #dfe6ee; --h2: #b9c7d6; --h3: #8ea3b9; --h4: #5f7a96; --h5: #2f4a66;
}
/* page: the record, and beside it on a wide screen its QR code, the other samples and the paste box */
header.top { padding: var(--space-6) 0 var(--space-4); }
header.top h1 { margin-bottom: var(--space-2); }
header.top .meta { max-width: var(--measure); }
.who { margin: 0 0 var(--space-2); font-size: var(--fs-lg); }
.reduced-note { border: 2px solid var(--fg-1); border-left-width: 6px; border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin: var(--space-2) 0; max-width: 40rem; }

/* upfront quantitative snapshot */
.snap { margin: var(--space-4) 0 var(--space-3); max-width: 52rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-2); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.65rem 0.85rem; display: flex; flex-direction: column; gap: 0.15rem; }
.kpi-accent { border-top: 3px solid var(--brand); }
.kpi-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-2); }
.kpi-val { font-size: 1.45rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.015em; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.kpi-of { font-size: 0.92rem; font-weight: 500; color: var(--fg-2); }
.kpi-bar { display: block; height: 5px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; margin: 0.2rem 0 0.1rem; }
.kpi-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.kpi-sub { font-size: var(--fs-xs); color: var(--fg-2); line-height: 1.35; }
.comp-wrap { margin-top: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.65rem 0.85rem; }
.comp-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); font-size: var(--fs-xs); font-weight: 600; color: var(--fg-2); margin-bottom: 0.4rem; }
.comp-tot { font-weight: 500; font-variant-numeric: tabular-nums; }
.comp-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 1.5px; background: var(--bg-alt); }
.comp-seg { min-width: 3px; height: 100%; }
.comp-legend { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.85rem; font-size: var(--fs-xs); color: var(--fg-2); }
.comp-legend li { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }
.comp-legend i { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 2px; flex: none; }
.comp-legend b { color: var(--fg-1); font-weight: 600; font-variant-numeric: tabular-nums; }
details.log-notes { margin-top: var(--space-3); }
details.log-notes ul.statements { margin-bottom: var(--space-3); }
nav.samples { border-top: 1px solid var(--border); padding: var(--space-5) 0 var(--space-3); }
nav.samples h2 { font-size: var(--fs-lg); }
/* the other records: tap targets of a comfortable height */
nav.samples ul.inline a, nav.samples ul.inline b { display: inline-block; padding: 0.55em 0; }

/* before the record is drawn: what is being opened, with the footer below the fold */
#app.opening { min-height: 100vh; }
.opening-msg { font-size: var(--fs-lg); padding: var(--space-6) 0; margin: 0; }

/* entries set aside before drawing (a pasted Bundle), like the reduced notice */

/* the jump list under the header: only the sections this record has */
nav.jump { margin: 0 0 var(--space-4); padding: var(--space-2) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); max-width: 52rem; }
nav.jump ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
nav.jump a { display: inline-block; padding: 0.45em 0; font-size: var(--fs-sm); }
.qr-open { margin: 0; }
.rec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: var(--space-3) 0 0; }
.rec-actions .fhirjson { display: contents; }
.rec-actions .fhirjson .size { order: 2; }
.rec-actions .fhirjson-view { flex-basis: 100%; order: 3; }

/* the QR code, large, over the page */
dialog.qr-big { width: min(calc(100vw - 0.5rem), 36rem); max-width: none; max-height: calc(100vh - 0.5rem); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--fg-1); }
dialog.qr-big::backdrop { background: rgba(24, 33, 44, 0.6); }
.qr-big-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.qr-big-top h2 { margin: 0; font-size: var(--fs-lg); }
dialog.qr-big .qr svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 9rem); background: #fff; }
.after h2 { font-size: var(--fs-lg); }
.vw .rec > section { max-width: 52rem; }
#app > .rec { max-width: 66rem; }
#app > .rec > section { max-width: none; }
#app > .rec .notice { max-width: none; }

/* summary */
ul.statements { margin: 0.4rem 0 0; padding-left: 1.2rem; }
ul.statements li { margin: 0.25rem 0; }
ul.statements li.caution { list-style: none; margin-left: -1.2rem; padding-left: 1.2rem; position: relative; }
ul.statements li.caution::before { content: "!"; position: absolute; left: 0.1rem; top: 0.05em; width: 0.95rem; height: 0.95rem; line-height: 0.95rem;
  text-align: center; font-size: 0.75rem; color: #fff; background: var(--fg-1); border-radius: 2px; }
ul.series { list-style: none; margin: 0.3rem 0; padding: 0; }
ul.series > li { margin: 0.2rem 0 0.7rem; }
ul.series .hm { margin-top: 0.2rem; }
.unk { font-size: 0.8rem; border: 1px solid var(--fg-1); border-radius: 3px; padding: 0 0.25em; white-space: nowrap; }

/* day cells */
/* Day cells. Bleeding days are the figure: filled, dark to light by flow. Everything else is ground,
   told apart by the cell's own treatment, not by a glyph, in decreasing strength of claim:
     recorded "no bleeding"  white, with a solid grey border
     nothing recorded        grey hatching, so gaps in the log read as gaps */
.c { display: block; min-width: 0; background: repeating-linear-gradient(135deg, var(--nr-ink) 0 1.5px, var(--nr) 1.5px 4px); }
.c.f0 { background: #fff; box-shadow: inset 0 0 0 1px #9ea8b3; }
.c.f1 { background: var(--f1); box-shadow: inset 0 0 0 1px var(--f3); }
.c.f2 { background: var(--f2); }
.c.f3 { background: var(--f3); }
.c.f4 { background: var(--f4); }
.c.fb { background: repeating-linear-gradient(135deg, var(--f3) 0 3px, #fff 3px 5px); }
.c.out { background: transparent; }
.c.proc { outline: 2px solid var(--fg-1); outline-offset: 0; z-index: 1; }
/* more than one bleeding entry that day: a white corner triangle edged in ink, visible on every fill */
.c.multi { position: relative; }
.c.multi::before, .c.multi::after { content: ""; position: absolute; top: 0; right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.c.multi::before { width: 55%; height: 55%; background: var(--fg-1); }
.c.multi::after { width: 38%; height: 38%; background: #fff; }
/* the day's bleeding entries disagree (bleeding and no bleeding): a diagonal stripe, white edged in ink, over the fill */
.c.disagree { background-image: linear-gradient(to top right, transparent 38%, #fff 38% 43%, var(--fg-1) 43% 57%, #fff 57% 62%, transparent 62%); }
.c[data-i] { cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; font-size: 0.85rem; color: var(--fg-2); margin: 0.4rem 0; }
.lg { display: inline-flex; align-items: baseline; gap: 0.3em; }
.lg > .c, .lg > .h, .lg > svg { flex: none; align-self: center; }
.lg .c, .lg .h { width: 0.9em; height: 0.9em; display: inline-block; }
.lg svg { width: 0.9em; height: 0.9em; }
.lg-lead { font-weight: 600; color: var(--fg-1); }

/* month calendar */
.cal { max-width: 40rem; }
.cal-row { display: grid; grid-template-columns: 2.6em minmax(0, 1fr); align-items: center; gap: 0.3em; margin: 1px 0; }
.cal-m { font-size: 0.72rem; color: var(--fg-2); line-height: 1.05; }
.cal-days { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 1px; }
.cal-days .c { aspect-ratio: 1; }
.cal-head .cal-days span { font-size: 0.7rem; color: var(--fg-2); white-space: nowrap; }

/* cycles */
ol.cycles { list-style: none; margin: 0; padding: 0; }
li.cyc { margin: 0.15rem 0 0.45rem; }
li.cyc.unused .cyc-h { color: var(--fg-2); }
.cyc-h { font-size: 0.88rem; }
.cyc-d { font-weight: 600; }
.cyc-n { display: block; font-size: 0.82rem; color: var(--fg-2); }
.cyc-n::before { content: "Note: "; font-weight: 600; }
.strip { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1px; margin-top: 0.1rem; }
.strip .c { height: 1.1em; }
.strip-axis span { font-size: 0.7rem; color: var(--fg-2); white-space: nowrap; }

/* symptom heat map */
.hm-row { margin: 0.35rem 0; }
.hm-l { font-size: 0.86rem; }
.hm-head .hm-l { color: var(--fg-2); }
.hm-cells { display: grid; gap: 1px; margin-top: 0.1rem; }
.hm-cells .h { display: block; height: 0.95em; }
.hm-axis span { font-size: 0.7rem; color: var(--fg-2); white-space: nowrap; }
.h { background: #f3f5f7; }
.h.h1 { background: var(--h1); } .h.h2 { background: var(--h2); } .h.h3 { background: var(--h3); } .h.h4 { background: var(--h4); } .h.h5 { background: var(--h5); }
.h.hx { background: repeating-linear-gradient(90deg, #fff 0 2px, #eef0f2 2px 4px); }
.unk-none { color: var(--fg-2); font-size: 0.8rem; }

/* fertility */
details > summary { font-size: var(--fs-sm); }
/* width auto, not 100%: inside a <details> the shared stylesheet gives children side margins, and
   100% plus those margins ran the fertility charts past the card's edge */
.chart { width: auto; min-height: 1px; }
.chart svg { display: block; max-width: 100%; }
.chart svg [data-i] { cursor: pointer; }

/* the day panel (daypanel.ts): docked beside the record on wide screens. On narrow ones it is a
   one-line bar at the bottom until a day is chosen, then a fixed-height sheet; its rows are the same
   for every day of a record, so the sheet's size never changes while stepping */
.daypanel { background: var(--bg); }
.daypanel[hidden] { display: none; }
@media (min-width: 68rem) {
  .vw { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 0 var(--space-6); align-items: start; }
  .daypanel { position: sticky; top: var(--space-3); height: calc(100vh - 2 * var(--space-3)); margin-top: var(--space-5); overflow-y: auto;
    border: 1px solid var(--border); border-top: 3px solid var(--fg-1); border-radius: var(--radius-md); padding: 0 var(--space-4) var(--space-3); }
}
@media (max-width: 67.99rem) {
  .daypanel { position: fixed; left: 0; right: 0; bottom: 0; height: min(44vh, 26rem); overflow-y: auto; z-index: 10;
    border-top: 3px solid var(--fg-1); box-shadow: 0 -6px 20px rgba(24, 33, 44, 0.16); padding: 0 var(--rail) var(--space-3); }
  .daypanel[data-state="idle"] { height: auto; overflow: hidden; padding-top: var(--space-2); padding-bottom: var(--space-2); box-shadow: 0 -3px 10px rgba(24, 33, 44, 0.12); }
  .daypanel[data-state="idle"] .dp-top, .daypanel[data-state="idle"] .dp-idle-full { display: none; }
  .dp-bar { margin: 0; font-size: var(--fs-sm); line-height: 1.35; }
  /* the page ends above whichever is showing, the bar or the sheet */
  body.has-day footer.site { padding-bottom: calc(3rem + 1.75rem); }
  body.has-day:has(#day[data-state="day"]) footer.site { padding-bottom: calc(min(44vh, 26rem) + 1.75rem); }
}
@media (min-width: 68rem) { .dp-bar { display: none; } }
.dp-top { position: sticky; top: 0; background: var(--bg); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); margin-bottom: var(--space-2); z-index: 1; }
.dp-top h2 { margin: 0; font-size: var(--fs-lg); }
.dp-wd { font-weight: 400; color: var(--fg-2); font-size: var(--fs-sm); }
.dp-nav { display: flex; gap: var(--space-1); }
/* line 1: the day between its arrows, and Close; line 2: weekday, cycle day, the cycle buttons */
.dp-day { display: flex; align-items: center; gap: var(--space-2); }
.dp-day h2 { white-space: nowrap; }
.dp-info { margin: 0; font-size: var(--fs-sm); color: var(--fg-2); }
.dp-info .dp-wd { color: var(--fg-1); font-size: inherit; }
.dp-actions { flex-basis: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--space-1); }
.dp-nav button, .dp-day button { min-width: 2.75rem; }
dl.dp-rows { margin: 0; display: grid; grid-template-columns: minmax(7em, max-content) minmax(0, 1fr); column-gap: var(--space-3); font-size: var(--fs-sm); }
dl.dp-rows > div { display: contents; }
dl.dp-rows dt, dl.dp-rows dd { margin: 0; padding: 3px 0; border-top: 1px solid var(--border-subtle); }
dl.dp-rows dt { color: var(--fg-2); }
dl.dp-rows dd.nr { color: var(--fg-3); font-style: italic; }
ul.dp-entries { list-style: none; margin: 0; padding: 0; }
.dp-disagree { font-weight: 600; }
ul.dp-entries li { margin: 0; }
.dp-time { color: var(--fg-2); white-space: nowrap; }
/* very narrow screens or large text: label above value, so values never break inside a word */
@media (max-width: 22rem) {
  dl.dp-rows { grid-template-columns: minmax(0, 1fr); }
  dl.dp-rows dd { border-top: 0; padding-top: 0; }
}
.daypanel > .dp-body > p { font-size: var(--fs-sm); }
/* the selected day, outlined wherever it appears; never by colour alone */
/* the chosen day: a thick ring standing off the cell, unlike the tight outline of a procedure day */
.c.sel-day { outline: 3px solid var(--fg-1); outline-offset: 2px; box-shadow: 0 0 0 2px var(--bg); position: relative; z-index: 2; }
.c[data-i]:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; position: relative; z-index: 3; }
svg .sel-day { fill: rgba(31, 41, 51, 0.12); stroke: #1F2933; stroke-width: 1.5; }

.cardqr .qr { margin: var(--space-3) 0; }
.cardqr .qr svg { display: block; width: min(100%, 24rem); height: auto; background: #fff; border: 1px solid var(--border); }

/* summary: what the person reports, the FIGO findings, the log */
dl.context { margin-top: var(--space-2); }
.caveat { display: block; font-size: var(--fs-xs); color: var(--fg-2); margin-top: 2px; }
.caveat::before { content: "Too few: "; font-weight: 650; }
.finding-note { display: block; font-size: var(--fs-xs); color: var(--fg-2); margin-top: 2px; }
.finding-note::before { content: "Reduced card: "; font-weight: 650; }
p.pcos { border-left: 3px solid var(--fg-1); padding-left: var(--space-3); max-width: var(--measure); }
details.sources > summary { font-size: var(--fs-sm); font-weight: 600; }
details.sources li { font-size: var(--fs-sm); }

/* screening answers, set apart from anything computed */
ul.answers { list-style: none; padding: 0; margin: var(--space-2) 0; max-width: var(--measure); }
ul.answers > li { padding: var(--space-2) var(--space-3); margin: 0 0 var(--space-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }
.logside { display: block; font-size: var(--fs-sm); color: var(--fg-2); margin-top: var(--space-1); }
.logside.differs { color: var(--fg-1); font-weight: 600; }
.logside.differs::before { content: "≠ "; }

/* measured fluid: one row per period, each day's value with its flow category */
ul.volumes { list-style: none; padding: 0; margin: var(--space-3) 0; border-top: 1px solid var(--border); max-width: 52rem; }
ul.volumes > li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); margin: 0; }
.vol-h { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); align-items: baseline; }
.vol-t { font-weight: 650; font-variant-numeric: tabular-nums; }
.perday { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: var(--space-1); }
.perday span { display: inline-flex; flex-direction: column; align-items: center; font-variant-numeric: tabular-nums; min-width: 2.4em; }
.perday small { font-size: 0.7rem; color: var(--fg-2); }
dl.figo dd .finding { font-weight: 600; }
dl.figo dd .rests { color: var(--fg-2); font-size: var(--fs-sm); }

/* SHA-256 extension codecs showcase on /view/ landing & extension sibling nav */
.nav-meta { font-size: var(--fs-xs); color: var(--fg-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.samples-hub-links { margin: var(--space-2) 0 0; font-size: var(--fs-sm); color: var(--fg-2); }

.ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
  gap: var(--space-4);
  margin: var(--space-4) 0;
}
.ext-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.ext-card-title-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}
.ext-card-title-row h3 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.05rem; line-height: 1.3; color: var(--fg-1); }
.ext-hub-link { flex: none; margin-top: 2px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.ext-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin: var(--space-2) 0;
}
.ext-paradigm {
  white-space: normal;
  line-height: 1.35;
  padding: 2px 9px;
  border-radius: 6px;
  max-width: 100%;
  overflow-wrap: break-word;
}
.ext-wasm {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  background: var(--info-wash);
  border-color: var(--brand-wash);
  color: var(--brand-ink);
}
.ext-summary { margin: 0; font-size: var(--fs-sm); color: var(--fg-2); line-height: 1.45; }
.ext-samples {
  list-style: none;
  margin: auto 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.ext-samples li { margin: 0; }
.ext-sample-link {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem var(--space-3);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--fg-1);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.ext-sample-link.is-featured {
  border-left: 3px solid var(--brand);
}
.ext-sample-link:hover, .ext-sample-link:focus-visible {
  border-color: var(--brand);
  background: var(--info-wash);
  text-decoration: none;
}
.ext-sample-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  min-width: 0;
  flex: 1 1 12rem;
}
.ext-sample-name {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--brand-ink);
  white-space: nowrap;
}
.ext-sample-title {
  color: var(--fg-2);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}
.ext-sample-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
