/* The two tools beside the medicine pages (website/src/tools), loaded after styles.css, blog.css and medicines.css:
   the printable injection site rotation chart (/injection-site-rotation-chart) and what a label says about a late dose
   (/missed-dose). Colours keep the app's meanings: green for an injection site and for rest, amber for a late dose's
   window and for the spot used last, pink for the dose. The chart is paper in both appearances, so it keeps the paper
   tokens of medicines.css and a green of its own that stays light; its print layout is rotation-print.css. */

:root {
  --paper-green: #077A50;
  --paper-zone: #8FC3B0;
  --paper-zone-some: #CDE4DC;
}

/* --------------------------------------------------------------------------------------------------------------------
   The rotation chart: the figure with its numbered spots and their key, beside a row for each week. */

.rot-sheet { min-width: 960px; }
.rot-body { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 4px; }
.rot-map { display: grid; gap: 8px; }
.rot-figure { position: relative; }
.rot-figure img { display: block; width: 100%; height: auto; }
.rot-figure svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rot-zone ellipse { fill: var(--paper-zone); stroke: var(--paper-green); stroke-width: 4; }
.rot-zone.is-some ellipse { fill: var(--paper-zone-some); stroke-dasharray: 10 7; }
.rot-zone text { font: 700 34px var(--text); fill: var(--paper-ink); text-anchor: middle; dominant-baseline: central; }
.rot-zone text.is-wide { font-size: 28px; letter-spacing: -0.04em; }
.rot-note { font-size: var(--text-fine); line-height: 1.4; color: var(--paper-ink-2); }
.rot-key { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: var(--text-fine); line-height: 1.3; color: var(--paper-ink); }
.rot-key li { display: flex; align-items: center; gap: 8px; }
.rot-some { display: flex; align-items: flex-start; gap: 8px; }
.rot-badge { display: inline-grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--paper-zone); box-shadow: inset 0 0 0 1.5px var(--paper-green); font: 700 11px/1 var(--text); color: var(--paper-ink); }
.rot-badge.is-some { background: var(--paper-zone-some); box-shadow: none; border: 1.5px dashed var(--paper-green); }
.rot-table { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1px solid var(--paper-ink); }
.rot-col-date { width: 88px; }
.rot-col-spot { width: 44px; }
.rot-group { border-left: 2px solid var(--paper-ink-3); border-right: 2px solid var(--paper-ink-3); }
.rot-table th { padding: 4px; text-align: center; vertical-align: middle; font: 600 var(--text-small)/1.2 var(--text); color: var(--paper-ink); background: var(--paper-head); }
.rot-table thead tr:first-child th { border-bottom: 1px solid var(--paper-rule); }
.rot-table thead tr:first-child th[rowspan] { padding-inline: 8px; text-align: left; }
.rot-table thead tr:last-child th { padding-block: 8px; border-bottom: 1px solid var(--paper-ink); }
.rot-table thead tr:last-child th + th { border-left: 1px solid var(--paper-rule); }
.rot-words { display: block; margin-top: 4px; font-weight: 400; font-size: var(--text-fine); line-height: 1.15; color: var(--paper-ink-2); }
.rot-table td { height: 28px; border-top: 1px solid var(--paper-rule); }
.rot-table td + td { border-left: 1px solid var(--paper-rule); }
.rot-table tbody tr:nth-child(even) td { background: var(--paper-zebra); }

/* --------------------------------------------------------------------------------------------------------------------
   The chart's page: ten made-up weeks read at a glance, and the spots each label lists. */

.rot-example-grid { display: grid; grid-template-columns: 64px repeat(10, minmax(0, 1fr)); gap: 4px; align-items: center; justify-items: center; }
.rot-example .rot-badge { width: 24px; height: 24px; border: 1.5px solid var(--good); background: color-mix(in srgb, var(--good) 20%, var(--surface)); box-shadow: none; font-size: var(--text-fine); color: var(--ink); }
.rot-example .rot-badge.is-some { border-style: dashed; background: transparent; }
.rot-example .rot-badge.is-rested { background: var(--good); color: var(--surface); }
.rot-week { justify-self: start; font: 700 var(--text-small)/1 var(--num); letter-spacing: 0.04em; color: var(--ink-3); white-space: nowrap; }
.rot-cell { position: relative; width: 100%; max-width: 40px; height: 24px; border-radius: var(--radius-xs); background: var(--sunken); }
.rot-cell.in-rested { background: color-mix(in srgb, var(--good) 18%, var(--sunken)); }
.rot-cell.is-mark::before { content: ''; position: absolute; inset: 0; width: 10px; height: 10px; margin: auto; border-radius: 50%; background: color-mix(in srgb, var(--ink-3) 60%, transparent); }
.rot-cell.is-last::before { background: var(--ink); }
.rot-cell.is-latest::before { width: 12px; height: 12px; background: var(--amber); box-shadow: var(--fx-last); }
.rot-cell.is-oldest::before { width: 12px; height: 12px; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 28%, transparent), var(--fx-rested); }
.rot-foot { grid-column: var(--col); padding: 4px 12px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--good) 16%, transparent); font: 600 var(--text-small)/1.2 var(--text); color: var(--ink); white-space: nowrap; }
.prose .rot-dots { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 0; padding: 0; list-style: none; font-size: var(--text-small); line-height: 1.4; color: var(--ink-3); }
.prose .rot-dots li { display: flex; align-items: center; gap: 8px; margin: 0; }
.rot-dots .rot-cell { width: 20px; height: 20px; flex: none; }
.rot-labels th[scope="row"] a { font-weight: 600; }
.rot-labels th[scope="row"] span { display: block; margin-top: 2px; font-size: var(--text-small); font-weight: 400; color: var(--ink-3); }
.rot-labels td { text-align: center; vertical-align: middle; }
.rot-dot { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.rot-dot.is-listed { border: 1.5px solid var(--good); background: color-mix(in srgb, var(--good) 45%, transparent); }
.rot-dot.is-helped { border: 1.5px dashed var(--good); }
.rot-dot.is-none { width: 12px; height: 2px; border-radius: var(--radius-xs); background: var(--ink-3); }

/* --------------------------------------------------------------------------------------------------------------------
   The late-dose page: the pickers, then the window drawn as the week's days, its facts, the app's card and the
   label's words, on one card. */

.late-stage { padding-block: 8px 48px; }
.late-tool { display: grid; gap: 24px; max-width: 880px; margin-inline: auto; padding: 32px; border-radius: var(--radius-xl); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline), var(--lift); scroll-margin-top: 92px; }
.late-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.late-controls[hidden] { display: none; }
.late-field { display: grid; align-content: start; gap: 8px; }
.late-label { font: 600 var(--text-ui)/1.3 var(--text); color: var(--ink-2); }
.late-controls .chip { min-height: 48px; padding-inline: 20px; font-size: var(--text-body); }
.late-when { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; grid-column: 1 / -1; }
.late-controls select, .late-controls input { width: 100%; min-height: 48px; padding: 8px 16px; border: 0; border-radius: var(--radius-md); background: var(--panel); box-shadow: inset 0 0 0 1px var(--hairline-strong); color: var(--ink); font: 400 var(--text-lead)/1.3 var(--text); }
.late-controls select { appearance: none; padding-right: 44px; background-image: none; }
.late-medicine { position: relative; }
.late-medicine::after { content: ''; position: absolute; right: 20px; bottom: 20px; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.late-controls select:focus-visible, .late-controls input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.late-result { display: grid; gap: 16px; }
.late-strip { position: relative; padding-block: 28px; }
.late-days { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; height: 16px; }
.late-days i { position: relative; overflow: hidden; border-radius: var(--radius-xs); background: var(--track); }
.late-days i::before { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--lit) * 100%); background: var(--amber); box-shadow: var(--fx-amber-2); }
.late-days i:first-child { border-radius: var(--radius-pill) var(--radius-xs) var(--radius-xs) var(--radius-pill); }
.late-days i:last-child { border-radius: var(--radius-xs) var(--radius-pill) var(--radius-pill) var(--radius-xs); }
.late-tick { position: absolute; top: 52px; left: var(--at); translate: -50% 0; font: 700 var(--text-small)/1 var(--num); letter-spacing: 0.04em; color: var(--ink-3); }
.late-now { position: absolute; top: 0; left: var(--at); width: 0; height: 48px; }
.late-now span { position: absolute; top: 0; left: 0; translate: -50% 0; font: 600 var(--text-small)/1 var(--text); color: var(--ink); }
.late-now::after { content: ''; position: absolute; top: 20px; bottom: 0; left: -1px; width: 2px; border-radius: 1px; background: var(--ink); }
.late-strip.is-small { padding: 0; }
.late-strip.is-small .late-days { height: 10px; }
.late-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.late-facts > div { display: grid; align-content: start; gap: 4px; padding: 12px 16px; border-radius: var(--radius-lg); background: var(--panel); }
.late-facts > .is-window { box-shadow: inset 0 0 0 1.5px var(--amber); }
.late-facts dt { font: 600 var(--text-small)/1.3 var(--text); color: var(--ink-3); }
.late-facts dd { display: grid; gap: 4px; margin: 0; }
.late-facts b { font: 700 var(--text-card)/1.05 var(--num); letter-spacing: 0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.late-facts span { font-size: var(--text-body); color: var(--ink-2); }
.late-facts small { font-size: var(--text-small); line-height: 1.4; color: var(--ink-3); }
.late-none { font-size: var(--text-body); line-height: 1.5; color: var(--ink-3); }
.late-card { display: grid; gap: 4px; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline-strong); }
.late-card-where { font-size: var(--text-small); color: var(--ink-3); }
.late-card-title { font: 600 var(--text-big)/1.3 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.late-card.is-late .late-card-title { color: var(--amber-text); }
.late-card.is-due .late-card-title { color: var(--accent); }
.late-card-detail { font-size: var(--text-body); line-height: 1.5; color: var(--ink-2); }

/* The label's words: every medicine and country in a list without a script; with one, only the chosen one. */
.late-list { padding-top: 24px; border-top: 1px solid var(--hairline); }
.late-words { display: grid; gap: 12px; }
.late-words .med-quote { margin: 0; }
.late-words-for { justify-self: start; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--chip); font: 600 var(--text-ui)/1.4 var(--text); color: var(--ink); }
.late-words-head { font: 600 var(--text-ui)/1.4 var(--text); color: var(--ink-3); }
.late-words-text { font-size: var(--text-lead); line-height: 1.6; color: var(--ink); }
.late-words-source { font-size: var(--text-small); line-height: 1.5; color: var(--ink-3); }
.late-words-source a { color: var(--accent); }
.late-group-name { margin-bottom: 12px; font: 600 var(--text-big)/1.3 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.late-tool:not(.is-live) .late-group + .late-group { margin-top: 32px; }
.late-tool:not(.is-live) .late-words + .late-words { margin-top: 20px; }
.late-tool.is-live .late-words:not(.is-on), .late-tool.is-live .late-group-name, .late-tool.is-live .late-words-for { display: none; }
.late-more { font-size: var(--text-body); line-height: 1.5; color: var(--ink-2); }
.late-more a, .late-fine a { color: var(--accent); }
.late-fine { font-size: var(--text-small); line-height: 1.6; color: var(--ink-3); }

/* Each weekly label's window at a glance: its days lit, and the words for them. */
.prose .late-glance { display: grid; gap: 12px; margin-top: 24px; margin-bottom: 0; padding: 0; list-style: none; }
.prose .late-glance li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'name strip' 'where words'; gap: 4px 24px; align-items: center; margin: 0; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.late-glance-name { grid-area: name; font: 600 var(--text-body)/1.4 var(--text); }
.late-glance-where { grid-area: where; font-size: var(--text-small); line-height: 1.4; color: var(--ink-3); }
.late-glance .late-strip { grid-area: strip; }
.late-glance-words { grid-area: words; font-size: var(--text-small); line-height: 1.4; color: var(--ink-2); }

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

@media (max-width: 640px) {
  .late-tool { gap: 20px; padding: 20px; margin-inline: -8px; }
  .late-controls { grid-template-columns: minmax(0, 1fr); }
  .late-facts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .late-facts > div { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 4px 12px; align-items: baseline; }
  .late-facts dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
  .late-facts small { flex-basis: 100%; }
  .late-facts b { font-size: var(--text-big); }
  .prose .late-glance li { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'name' 'where' 'strip' 'words'; gap: 8px; }
  .rot-example-grid { grid-template-columns: 52px repeat(10, minmax(0, 1fr)); }
  .rot-example .rot-badge { width: 20px; height: 20px; }
  .rot-week { font-size: var(--text-fine); }
  .rot-cell { height: 20px; }
  .rot-labels th, .rot-labels td { padding-inline: 8px; }
  .rot-labels th:first-child { padding-left: 16px; }
}
