/* The medicine pages (/medicines, /medicines/<slug>) and the printable log (/glp-1-tracker-template), loaded after
   styles.css and blog.css: they are guide-like pages, a reading column with figures in it. Colours keep the app's
   meanings: pink for the dose and its ladder, cyan for the level estimate, green for an injection site, amber for a
   late dose. The printable sheet is paper in both appearances, so it has tokens of its own that stay light; its
   print layout is log-print.css. */

:root {
  --paper: #FFFFFF;
  --paper-ink: #0B0B10;
  --paper-ink-2: #55555F;
  --paper-ink-3: #6E6E78;
  --paper-rule: #C8C8D0;
  --paper-head: #ECECF1;
  --paper-zebra: #F6F6F8;
  --paper-shadow: 0 1px 2px rgba(11, 11, 16, 0.06), 0 30px 60px -36px rgba(11, 11, 16, 0.35);
  --paper-stage: var(--sunken);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper-shadow: 0 40px 90px -40px rgba(255, 45, 120, 0.35);
    --paper-stage: var(--raised);
  }
}
:root[data-theme="dark"] {
  --paper-shadow: 0 40px 90px -40px rgba(255, 45, 120, 0.35);
  --paper-stage: var(--raised);
}

/* --------------------------------------------------------------------------------------------------------------------
   The header: the App Store link and when the labels were checked. */

.med-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 4px; }
.med-cta .badge-store { min-height: 52px; }
/* On the app's dark card the link is light in both appearances. */
.badge-store.badge-on-card { margin-top: 8px; background: #F5F5F7; color: #000000; }

/* --------------------------------------------------------------------------------------------------------------------
   The summary: four facts, one number each; or a row for each medicine on a page with two. */

.med-glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.med-glance p { display: grid; align-content: start; gap: 8px; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.med-glance strong { font: 700 40px/0.95 var(--num); letter-spacing: 0.005em; color: var(--ink); font-variant-numeric: tabular-nums; }
.med-glance .is-long strong { font-size: var(--text-head); line-height: 1.05; }
.med-glance span { font-size: var(--text-ui); line-height: 1.45; color: var(--ink-3); }

.med-table { overflow-x: auto; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.med-table table { width: 100%; border-collapse: collapse; font-size: var(--text-body); line-height: 1.45; }
.med-table th, .med-table td { padding: 12px 16px; text-align: left; vertical-align: top; }
.med-table thead th { font: 600 var(--text-ui)/1.3 var(--text); color: var(--ink-2); background: var(--sunken); }
.med-table tbody th { font-weight: 600; color: var(--ink); }
.med-table td { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.med-table tbody tr + tr > * { border-top: 1px solid var(--hairline); }

/* --------------------------------------------------------------------------------------------------------------------
   Blocks for one medicine on a page with two, its name as a small label on top. */

/* Lists on these pages indent by the 4-pixel grid, not by the guides' 1.3em. */
.med-prose ul, .med-prose ol, .log-page .prose ol { margin-bottom: 0; padding-left: 24px; }
.prose .med-product { margin-top: 24px; }
.med-product > * + * { margin-top: 16px; }
.med-product-name { display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--chip); font: 600 var(--text-ui)/1.4 var(--text); color: var(--ink); }

/* The label's words: quoted on a card, the label and section under them. */
.med-quote { margin: 16px 0 0; }
.med-quote blockquote { margin: 0; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.med-quote blockquote p { font-size: var(--text-lead); line-height: 1.6; color: var(--ink); }
.med-quote blockquote p + p { margin-top: 12px; }
.med-quote-context { font-weight: 600; color: var(--ink-2); }
.med-quote figcaption { margin-top: 8px; padding-inline: 4px; font-size: var(--text-small); line-height: 1.5; color: var(--ink-3); }
.med-quote-table .med-table td:last-child { font: 700 var(--text-big)/1.3 var(--num); color: var(--ink); }
.med-label-says { font: 600 var(--text-ui)/1.4 var(--text); color: var(--ink-3); }
.med-app-line { color: var(--ink-2); }
.med-fine, .med-note { font-size: var(--text-small); line-height: 1.6; color: var(--ink-3); }
.med-fine a { color: var(--accent); }
.med-source { font-size: var(--text-body); }

/* What the app shows, in its own words: the late-dose card's lines. */
.med-app-says { display: grid; gap: 4px; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink-2); }
.med-app-says-where { font-size: var(--text-small); color: var(--ink-3); }
.med-app-says strong { font: 600 var(--text-big)/1.3 var(--display); letter-spacing: -0.015em; color: var(--amber-text); }

/* --------------------------------------------------------------------------------------------------------------------
   The label's dose ladder: bars rising a step at a time, pinker as they rise, each dose under its bar. */

.prose .med-ladder, .med-ladder { --n: 6; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; align-items: end; max-width: calc(var(--n) * 104px); height: 164px; margin: 24px 0 0; padding: 0 0 28px; list-style: none; }
.prose .med-ladder li { position: relative; height: var(--h); margin: 0; border-radius: var(--radius-md) var(--radius-md) var(--radius-xs) var(--radius-xs); background: color-mix(in srgb, var(--accent) var(--h), var(--track)); }
.med-ladder li::marker { content: none; }
.med-ladder span { position: absolute; top: calc(100% + 8px); left: 0; right: 0; text-align: center; font: 700 var(--text-body)/1 var(--num); letter-spacing: 0.02em; color: var(--ink-2); }
.med-ladder.is-compact { gap: 4px; height: 96px; margin-top: 12px; padding-bottom: 24px; }
.med-ladder.is-compact span { font-size: var(--text-small); }
.med-steps strong { font-weight: 600; }

/* --------------------------------------------------------------------------------------------------------------------
   The level estimate: the app's line in the level's cyan, marked Estimate. */

.med-level-head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.med-estimate { padding: 4px 12px; border-radius: var(--radius-pill); background: var(--chip); font: 600 var(--text-small)/1.3 var(--text); color: var(--ink-2); }
.med-level-name { font-size: var(--text-ui); color: var(--ink-2); }
.med-level-svg { width: 100%; height: auto; overflow: visible; color: var(--line-level); }
.med-level-line { fill: none; stroke: var(--line-level); stroke-width: 3; stroke-linejoin: round; filter: var(--fx-level-line); }
.med-level-grid { stroke: var(--hairline-strong); stroke-dasharray: 2 6; }
.med-level-settle { stroke: var(--line-level); stroke-opacity: 0.55; stroke-dasharray: 4 6; }
.med-level-base { stroke: var(--hairline-strong); }
.med-level-dose { fill: var(--accent); }
.med-level-head { fill: var(--line-level); }
.med-level-week, .med-level-label { font: 600 13px var(--num); letter-spacing: 0.04em; fill: var(--ink-3); }
.med-level figcaption > * + * { margin-top: 12px; }
.prose .med-level figcaption ul { padding-left: 20px; }
.med-level-title { font-weight: 600; color: var(--ink); }

/* --------------------------------------------------------------------------------------------------------------------
   The label's injection sites over the app's body figure (blog.css's .body swaps it for light and dark). */

.med-sites-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 24px; align-items: center; }
.med-body svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.med-zone { fill: color-mix(in srgb, var(--good) 45%, transparent); stroke: var(--good); stroke-width: 5; }
.med-zone.is-helped { fill: none; stroke: var(--ink-3); stroke-dasharray: 10 8; }
.med-sites-side { display: grid; gap: 12px; }
.med-sites-words { font: 600 var(--text-big)/1.4 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.prose .med-key, .med-key { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: var(--text-ui); color: var(--ink-2); }
.prose .med-key li { display: flex; align-items: center; gap: 8px; margin: 0; }
.med-key i { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.med-key-site { background: color-mix(in srgb, var(--good) 45%, transparent); border: 1.5px solid var(--good); }
.med-key-helped { border: 1.5px dashed var(--ink-3); }

/* The label's common side effects, as the app's list names them. */
.prose .med-chips, .med-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.prose .med-chips li { margin: 0; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--chip); font-size: var(--text-ui); line-height: 1.5; color: var(--ink); }
.med-store { margin-top: 16px; }
.med-store ul { margin-top: 8px; }
.med-store-for { font: 600 var(--text-ui)/1.45 var(--text); color: var(--ink); }

/* Another country's rules in the app's words: a term and its words, row by row. */
.med-rules { margin: 20px 0 0; }
.med-rules > div { padding: 16px 0; border-top: 1px solid var(--hairline); }
.med-rules dt { font: 600 var(--text-ui)/1.4 var(--text); color: var(--ink); }
.med-rules dd { margin: 4px 0 0; font-size: var(--text-lead); line-height: 1.6; }
.med-rules dd ul { margin-top: 4px; }
.med-sources li { font-size: var(--text-body); line-height: 1.6; }

/* --------------------------------------------------------------------------------------------------------------------
   The index: a card for each page, the label's ladder on it. */

.med-index { padding-bottom: 24px; }
.med-cards { margin-top: 8px; }
.med-card .card-art .med-ladder { width: 64%; height: 92px; margin: 16px 0 0; padding-bottom: 24px; }
.med-card .card-art .med-ladder li { position: relative; height: var(--h); border-radius: var(--radius-sm) var(--radius-sm) var(--radius-xs) var(--radius-xs); background: color-mix(in srgb, var(--accent) var(--h), var(--track)); }
.med-card .card-art .med-ladder span { color: var(--ink-3); }
.med-index-more { max-width: 768px; padding-block: 24px 96px; }
.med-index-more .prose > h2:first-child { margin-top: 32px; }

/* --------------------------------------------------------------------------------------------------------------------
   The printable log: the downloads, then the sheet on its stage as the paper it prints as. */

.log-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
a.btn, .log-actions .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; text-decoration: none; }
.log-actions .btn .icon { width: 18px; height: 18px; }
.log-actions .btn[hidden] { display: none; }
.log-stage { padding-block: 8px 48px; }
.log-paper { overflow-x: auto; padding: 32px; border-radius: var(--radius-xl); background: var(--paper-stage); }
.log-swipe { display: none; }
.sheet { min-width: 880px; padding: 32px 36px 24px; border-radius: var(--radius-sm); background: var(--paper); color: var(--paper-ink); box-shadow: var(--paper-shadow); font-family: var(--text); }
.sheet-head { display: flex; align-items: baseline; gap: 24px; }
.sheet-title { flex: none; font: 700 var(--text-head)/1 var(--display); letter-spacing: -0.02em; }
.sheet-field { display: flex; flex: 1 1 auto; align-items: baseline; gap: 8px; font-size: var(--text-small); color: var(--paper-ink-2); }
.sheet-field span { flex: 1; border-bottom: 1px solid var(--paper-ink-3); }
.sheet-field-short { flex: 0 1 200px; }
.sheet-hint { margin: 12px 0 12px; font-size: var(--text-fine); line-height: 1.4; color: var(--paper-ink-2); }
.sheet-table { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1px solid var(--paper-ink); }
.sheet-table th { padding: 8px 8px 8px; text-align: left; vertical-align: top; font: 600 var(--text-small)/1.25 var(--text); color: var(--paper-ink); background: var(--paper-head); border-bottom: 1px solid var(--paper-ink); }
.sheet-table th span { display: block; margin-top: 2px; font-weight: 400; font-size: var(--text-fine); color: var(--paper-ink-3); }
.sheet-table th + th, .sheet-table td + td { border-left: 1px solid var(--paper-rule); }
.sheet-table td { height: 32px; border-top: 1px solid var(--paper-rule); }
.sheet-table tbody tr:nth-child(even) td { background: var(--paper-zebra); }
.sheet-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 12px; font-size: var(--text-fine); color: var(--paper-ink-3); }
.sheet-mark { display: inline-flex; align-items: center; gap: 6px; color: var(--paper-ink-2); }
.sheet-mark svg { width: 16px; height: 16px; }
.sheet-mark b { color: var(--paper-ink); }
.log-columns { margin: 20px 0 0; }
.log-columns > div { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 4px 20px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.log-columns dt { font: 600 var(--text-ui)/1.6 var(--text); color: var(--ink); }
.log-columns dd { margin: 0; font-size: var(--text-lead); line-height: 1.6; }

/* --------------------------------------------------------------------------------------------------------------------
   Narrow */

@media (max-width: 640px) {
  .med-glance strong { font-size: 32px; }
  .med-glance .is-long { grid-column: 1 / -1; }
  .med-sites-grid { grid-template-columns: minmax(0, 1fr); }
  .med-ladder { gap: 4px; height: 132px; }
  .med-ladder span { font-size: var(--text-small); }
  .med-level-week, .med-level-label { font-size: 24px; }
  .log-paper { padding: 16px; margin-inline: -8px; }
  .log-swipe { display: block; margin-top: 12px; font-size: var(--text-small); line-height: 1.5; color: var(--ink-3); text-align: center; }
  .log-columns > div { grid-template-columns: minmax(0, 1fr); }
  .med-quote blockquote { padding: 16px; }
  /* A page with two medicines: each one's row as a card of its own, every value under its column's name. */
  .med-glance-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .med-glance-table table, .med-glance-table tbody, .med-glance-table th, .med-glance-table td { display: block; }
  .med-glance-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px; }
  .med-glance-table tbody tr + tr { border-top: 1px solid var(--hairline); }
  .med-glance-table tbody tr + tr > * { border-top: 0; }
  .med-glance-table tbody th { grid-column: 1 / -1; padding: 0; font-size: var(--text-lead); }
  .med-glance-table td { padding: 0; }
  .med-glance-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: var(--text-small); color: var(--ink-3); }
}
