/* How we handle your data. A document on a white ground: nine numbered statements under hairlines, a list that
   stays put on the left, and one small picture. Statement 07 sits on its own paper ground in the page's largest
   type. On a phone the statements are rows that open, and the list is one button at the bottom. */

/* Statement 07's ground runs past both edges of the column, and the section cuts it off at the window. */
.d-doc { isolation: isolate; overflow-x: clip; }
.d-grid { row-gap: 0; }

/* ---------- the top ---------- */
.d-top { display: grid; grid-template-columns: minmax(0, 1fr) clamp(150px, 18vw, 300px); gap: 24px clamp(24px, 4vw, 72px); align-items: start; padding-bottom: clamp(36px, 4vw, 60px); }
.d-words { --gap: clamp(18px, 2vw, 30px); padding-top: 4px; }
.d-words .k-h2 { max-width: 15.5em; }
.d-pic { --ar: 18 / 22; --sq-r: 20px; background: var(--table); }
/* The picture is the whole clinic. The window shows one corner of it, the figure outside the records room. */
.d-pic > img { inset: auto; left: 27%; top: 88%; width: auto; height: 250%; max-width: none; translate: -27% -88%; }

/* ---------- the left column ---------- */
.d-side { z-index: 1; }
.d-actions { display: grid; gap: 8px; justify-items: start; margin-top: 6px; }
/* The kit fills a chip with the band's raised surface, which is this page's paper. This chip also passes over
   statement 07's paper ground, so it takes the quiet button's tint, which shows on both. */
.d-actions .k-chips > :not([aria-pressed="true"]) { --sq-fill: var(--tint); }
.d-changes-note:empty { display: none; }
html:not(.js) .d-actions { display: none; }
/* While only the changes show, a statement with none steps back in the list. */
.is-changes .k-toc a:not(.has-change) { color: var(--dim); }

/* ---------- a statement ---------- */
.d-st { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: start; padding-block: clamp(26px, 2.4vw, 36px) clamp(44px, 5vw, 76px); border-top: 1px solid var(--rule); }
/* A statement keeps its place and its hairline while its words rise, so a jump from the list lands exactly. */
.d-st.will-arrive { opacity: 1; translate: none; }
.d-st.will-arrive > * { opacity: 0; translate: 0 28px; }
.d-st.will-arrive.is-in > * { opacity: 1; translate: none; transition: opacity 0.7s, translate 0.7s var(--out); }
.d-meta { grid-column: 1 / -1; margin-bottom: 14px; }
.d-title { grid-column: 1; max-width: 19em; }
.d-title a { text-decoration-thickness: 1px; text-decoration-color: var(--faint); text-underline-offset: 0.14em; }
.d-tools { position: relative; grid-column: 2; }
.d-body { grid-column: 1 / -1; margin-top: clamp(18px, 2vw, 28px); }
.d-body > * + * { margin-top: clamp(18px, 2vw, 28px); }
.d-body > p { max-width: 37em; }
.d-body a { text-decoration-thickness: 1px; text-decoration-color: var(--faint); text-underline-offset: 0.2em; }
.d-body a:hover { text-decoration-color: currentColor; }
.d-body .btn, .d-body .k-link { text-decoration: none; }
.d-nb { white-space: nowrap; }
.d-src { display: flex; flex-wrap: wrap; gap: 4px 1.4em; }

/* A vendor or a standard, the sentence, and where it was read. */
.d-led { --cols: 7.5em minmax(0, 1fr) 11.5em; }
.d-led.is-wide { --cols: 9.5em minmax(0, 1fr) 11.5em; }
.d-led q { quotes: '"' '"'; }
.d-led code { font: 400 0.9em/1 var(--mono); }
.d-changed { display: block; color: var(--ink); }


/* Statement 07. Its ground runs the full width of the window, behind the list on the left. */
.d-audit { --raise: var(--white); padding-block: clamp(36px, 4vw, 60px) clamp(56px, 6vw, 96px); border-top: 0; }
.d-audit::before { content: ''; position: absolute; z-index: -1; inset: 0 -100vw; background: var(--paper); }
.d-audit .d-title { max-width: 9em; }
.d-audit + .d-pair, .d-audit + .d-st { border-top: 0; }
.d-two { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: 32px clamp(32px, 4.6vw, 72px); align-items: start; margin-top: clamp(28px, 3.4vw, 52px); }
.d-sub { padding-bottom: 8px; font-weight: 500; }
.d-list:not(.is-quiet) .k-row { color: var(--ink); }

/* Statements 08 and 09 side by side. Their copy buttons go under the words, where the column has room. */
.d-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(32px, 5vw, 80px); border-top: 1px solid var(--rule); }
.d-pair > .d-st { border-top: 0; grid-template-rows: auto auto 1fr auto; }
.d-pair .d-title { grid-column: 1 / -1; }
.d-pair .d-tools { grid-area: 4 / 1 / 5 / -1; justify-self: start; margin-top: 26px; }
.d-pair .k-actions { margin-top: 26px; }

/* What a copy button says once the statement is on the clipboard. page-data.js adds it and takes it away. */
.d-note { --sq-r: 16px; --sq-fill: var(--white); --sq-shadow: var(--lift); position: absolute; z-index: 5; right: 0; top: calc(100% + 10px); display: grid; gap: 6px; width: min(322px, 78vw); padding: 14px 16px 16px; font-size: 15px; line-height: 1.35; text-align: left; color: var(--ink); opacity: 0; scale: 0.94; transform-origin: 100% 0; visibility: hidden; transition: opacity 0.2s, scale 0.4s var(--bounce), visibility 0s 0.2s; }
.d-note.is-on { opacity: 1; scale: 1; visibility: visible; transition: opacity 0.2s, scale 0.4s var(--bounce), visibility 0s; }
.d-note small { display: flex; justify-content: space-between; gap: 12px; font: 500 12px/1.2 var(--mono); color: var(--soft); }
.d-pair .d-note, .d-sheet .d-note { right: auto; left: 0; transform-origin: 0 0; }
.d-sheet .d-note { top: auto; bottom: calc(100% + 10px); right: 0; width: auto; transform-origin: 50% 100%; }

/* ---------- the list as one button ---------- */
/* Below 900px there is no room for the left column. page-data.js moves the list into a kit card and shows this
   button, which opens it. With script off the list stays in the page above the statements. */
.d-bar { position: fixed; z-index: 120; inset: auto var(--m) max(12px, env(safe-area-inset-bottom)) var(--m); display: none; transition: translate 0.4s var(--out), opacity 0.3s; }
.d-bar.is-away { translate: 0 90px; opacity: 0; pointer-events: none; }
.d-bar .btn { --sq-r: 14px; --sq-fill: var(--todo); --sq-shadow: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1)) drop-shadow(0 10px 22px rgba(0, 0, 0, 0.14)); width: 100%; min-height: 56px; justify-content: space-between; padding-inline: 20px; font-size: 17px; color: var(--ink); }
.d-bar .btn:hover { scale: 1; }
.d-bar .btn span { font: 500 13px/1 var(--mono); color: var(--soft); }
.d-sheet .k-toc a { align-items: center; min-height: 44px; font-size: 13px; }
.d-sheet footer { position: relative; margin-top: 4px; }
.d-sheet footer .btn { flex: 1; }
.d-sheet:not(.is-pinned) .k-pop-x { display: none; }

/* A statement as a row. The button page-data.js adds covers the row while it is shut and the top line once it
   is open, so the heading inside keeps its own link. */
.d-toggle { position: absolute; z-index: 2; inset: 0; }
.d-st.is-open > .d-toggle { inset: 0 0 auto 0; height: 50px; }
.d-toggle::before, .d-toggle::after { content: ''; position: absolute; right: 4px; top: 27px; width: 14px; height: 2px; background: var(--ink); opacity: 0.5; transition: rotate 0.4s var(--out), opacity 0.2s; }
.d-toggle::after { rotate: 90deg; }
.d-st.is-open > .d-toggle::after { rotate: 0deg; }
.d-st.is-open > .d-toggle::before, .d-st.is-open > .d-toggle::after { opacity: 1; }
.d-toggle:focus-visible { outline-offset: -3px; }

/* Wide: the top and the statements share the right column, and the list runs down the left beside both. */
@media (min-width: 900px) {
  .d-grid > .d-top, .d-grid > .d-statements { grid-column: 2; }
  .d-grid > .d-side { grid-column: 1; grid-row: 1 / span 2; }
  /* With only the changes showing the page is short. This leaves the list room to stay under the menu. */
  .d-doc.is-changes .d-statements { min-height: 560px; }
}

@media (max-width: 1199px) {
  .d-led, .d-led.is-wide { --cols: 6.5em minmax(0, 1fr) 160px; }
}

@media (max-width: 899px) {
  .d-side { z-index: auto; padding-bottom: 28px; }
  .d-actions { display: flex; flex-wrap: wrap; align-items: center; }
  .d-actions .btn { min-height: 44px; }
  .js .d-bar { display: block; }
  .d-two { grid-template-columns: minmax(0, 1fr); }
  .d-doc { padding-bottom: 120px; }
  /* With script off the list is in the page, and its rows are tall enough for a thumb. */
  .d-side .k-toc a { align-items: center; min-height: 44px; font-size: 13px; }
}

/* A phone. The picture is a short band at the top, under the menu, and each statement is a row. */
@media (max-width: 699px) {
  .d-doc.is-first { padding-top: 0; }
  .d-top { display: flex; flex-direction: column; gap: 22px; padding-bottom: 28px; }
  .d-fig { order: -1; margin-inline: calc(var(--m) * -1); }
  .d-pic { --ar: auto; --sq-r: 0px; height: 62vw; }
  .d-fig .k-caption { margin-inline: var(--m); }
  .d-words .k-h2 { font-size: clamp(28px, 7.4vw, 36px); }
  .d-led, .d-led.is-wide { --cols-s: minmax(0, 1fr); }
  .d-led small a { display: inline-flex; align-items: center; min-height: 44px; }
  .d-changed { padding-top: 6px; }
  .d-pair { grid-template-columns: minmax(0, 1fr); border-top: 0; }
  .d-pair > .d-st { border-top: 1px solid var(--rule); }
  .d-audit:not(.is-row) + .d-pair > .d-st:first-child, .d-audit.is-open + .d-pair > .d-st:first-child { border-top: 0; }
  .d-pic > img { top: 78%; height: 220%; translate: -27% -78%; }

  .d-st { grid-template-columns: minmax(0, 1fr); padding-block: 22px 40px; }
  .d-tools, .d-pair .d-tools { grid-area: auto; order: 1; justify-self: stretch; margin-top: 22px; }
  .d-tools .btn { width: 100%; min-height: 48px; font-size: 15px; }
  .d-note { left: 0; width: auto; transform-origin: 50% 0; }

  /* Shut: the number, then the sentence, on one line of the list. Open: the statement as it reads on a wide screen. */
  .d-st.is-row { padding-right: 30px; }
  .d-st.is-row .d-meta { min-height: 12px; }
  .d-st.is-row:not(.is-open) { grid-template-columns: 2.2em minmax(0, 1fr); column-gap: 0; align-items: baseline; padding-block: 17px; border-top: 1px solid var(--rule); }
  .d-st.is-row:not(.is-open) .d-meta { grid-column: 1; margin: 0; }
  .d-st.is-row:not(.is-open) .d-meta > span + span { display: none; }
  .d-st.is-row:not(.is-open) .d-title { grid-column: 2; font-size: 17px; font-weight: 400; line-height: 1.3; letter-spacing: 0; text-wrap: pretty; }
  .d-st.is-row:not(.is-open) .d-tools { display: none; }
  .d-st.is-row:not(.is-open) .d-body { margin: 0; }
  .d-st.is-row.is-here:not(.is-open) .d-title { font-weight: 600; }
  .d-audit.is-row:not(.is-open)::before { content: none; }
  .d-st.is-row.is-open { padding-right: 0; }
  .d-st.is-row:not(.is-open) .sharp-w { opacity: 1; filter: none; }
}

/* Only what changed. A statement with no change folds to nothing but keeps its place in the page, so the list
   still knows where the reader is. These come after the phone rules so a shut row folds too. */
.d-doc.is-changes .d-st:not(:has([data-changed])), .d-doc.is-changes .d-pair:not(:has([data-changed])) { visibility: hidden; height: 0; min-height: 0; padding-block: 0; border: 0; overflow: hidden; }
.d-doc.is-changes .d-led > .k-row:not([data-changed]) { display: none; }

@media (prefers-reduced-motion: reduce) {
  .d-note, .d-bar, .d-toggle::after { transition-duration: 0.01s; }
}

@media print {
  .d-bar, .d-actions, .d-tools, .d-toggle { display: none; }
  .d-audit::before { content: none; }
}
