/*
 * pillo.center documents (privacy.html, terms.html, problems/index.html): the layout that only a long
 * document has. Linked after /site.css; everything shared (tokens, type scale, header, footer, chips,
 * the foil card, the icon well) is there.
 * Source: docs/design/2026-10-01-blister-2-site-mockups.html, #docs (the privacy policy is drawn).
 *
 * THE TEXT IS UNTOUCHED. This file only dresses it: the legal sentences, the section ids and the links
 * into them (/terms#pidpyska, /privacy#prava, /problems/#gone) are exactly what they were, and
 * SiteCopyTests compares the visible text of each page with the text it had before the redesign.
 *
 * LAYOUT. A head (eyebrow, h1, the edition chips, the «Коротко» summary as a foil card), then the
 * contents list and the article. From 68.75 em (1100 px at the default size) the contents list is a
 * sticky left column that follows the reader (site.js marks the section being read); below that it is a
 * card above the article. The article's measure is 40 rem, about 68 characters at the body size.
 * Breakpoints are in em (see site.css), so a larger browser font moves them.
 *
 * ANCHORS. A link into a section lands below the sticky header: site.css gives the page a
 * scroll-padding-top that is the header's height, and the target adds a little air of its own.
 */

/* ============================== layout ============================== */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.doc > * {
  min-width: 0;
}
@media (min-width: 68.75em) {
  .doc {
    grid-template-columns: 15.5rem minmax(0, 40rem);
    column-gap: clamp(32px, 4vw, 56px);
  }
  .dochead {
    grid-column: 1 / -1;
  }
  .toc {
    grid-column: 1;
    grid-row: 2;
  }
  .prose {
    grid-column: 2;
    grid-row: 2;
  }
}

/* ============================== head ============================== */

.dochead {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.dochead > * {
  margin: 0;
  /* see .page-head in site.css: a word wider than the column breaks instead of widening the page */
  min-width: 0;
  max-width: 100%;
}
.dochead h1 {
  max-width: min(24ch, 100%);
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* The edition line is ONE paragraph of the old page (kept whole: «Редакція від … · чинна з …»); its two chips
   are laid out as items of the row beside the section-count chip. */
.meta > .edition {
  display: contents;
}
/* The edition chips stay readable at a big text size: they may wrap instead of widening the page. */
.meta .chip {
  white-space: normal;
}

.brief {
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  max-width: 48rem;
  padding: 20px 22px;
}
.brief-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.brief-body > * {
  margin: 0;
}
.brief-body p:not(.eyebrow) {
  font-size: 1.0625rem;
  line-height: 1.6;
}
/* The same cut as the callout's (site.css): the icon above the summary where the line would be 1-2 words. */
@media (max-width: 19.9375em) {
  .brief {
    flex-direction: column;
    gap: 12px;
  }
}

/* ============================== contents ============================== */

.toc {
  padding: 16px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.toc .eyebrow {
  margin: 0 0 6px;
  padding-inline: 10px;
}
.toc ol {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
}
/* The number is generated, as the browser numbered the old list: it is not text in the page. */
.toc a {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 4px;
  align-items: baseline;
  align-content: center;
  min-height: 2.5rem;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--muted);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.toc a::before {
  content: counter(toc);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.toc a:hover {
  background: var(--well);
  color: var(--ink);
}
.toc a[aria-current="location"] {
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-weight: 700;
}
@media (min-width: 36em) and (max-width: 68.6875em) {
  .toc ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }
}
@media (min-width: 68.75em) {
  /* A column beside the text, not a card above it, and it follows the reader. A long list (the 50
     identifiers of /problems/) scrolls inside the column instead of running off the screen. */
  .toc {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background: none;
  }
}

/* ============================== the text ============================== */

.prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 1.0625rem;
  line-height: 1.72;
}
.prose > * {
  margin: 0;
}
/* Every section, subsection and table row an in-page link can land on keeps a little air below the sticky
   header: the page's scroll-padding is exactly the header's height, and a row landing flush under it lost its
   top pixel (/problems/#admin-csrf-failed measured 72 px against a header ending at 73). */
.prose [id] {
  scroll-margin-top: .75rem;
}
.prose h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  /* The title is the flex item beside the number well, and its min-content is its longest word (the shared
     h2's `break-word` does not shrink that): «Відповідальність» at Very large text on a 320 px phone widened
     the page by 49 px. `anywhere` lets the item shrink and break the word, only when it cannot fit. */
  overflow-wrap: anywhere;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose h3 {
  margin-top: 8px;
}
/* The section number is a well, as the day's doses are in the app. The old text was «1. Хто ми»: the number
   and its full stop are both still in the heading, the stop only for a screen reader (.sr). */
.secn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-size: .9375rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.prose ul,
.prose ol {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 1.4rem;
}
.prose li::marker {
  color: var(--muted);
}
.prose a {
  color: var(--brand-ink);
  font-weight: 600;
  text-decoration-thickness: 1px;
}
.prose em {
  font-style: italic;
}
.dochead code,
.brief code,
.prose code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--well);
  font-family: var(--mono);
  font-size: .88em;
  overflow-wrap: anywhere;
}

/* The notes inside the text are callouts (site.css); inside a long column they need air above and below. */
.prose .callout {
  margin-block: 6px;
}

/* ============================== tables ============================== */

.scroller {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.prose table {
  width: 100%;
  min-width: 34rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9688rem;
  line-height: 1.55;
}
.prose th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--well);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.prose td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose tr:last-child td {
  border-bottom: 0;
}
/* A link to one identifier (/problems/#gone) shows which row it meant. */
.prose tr:target td {
  background: var(--brand-tint);
}
/* The identifier column of /problems/ (the table's `ids` class): an identifier is never broken across lines,
   half a slug is a different slug (the old page said so in a comment and in `white-space: nowrap`). The
   column holds nothing else, and the table scrolls inside its box (.scroller) where the page is narrower than
   it. `.prose code` allows a break anywhere, which is right for an address in a sentence and lets this column
   shrink to a letter wide, so the identifier opts out of it. Scoped to `.ids`: the first column of the tables
   in the privacy policy and the terms is a sentence, and that one must wrap. */
.prose .ids td:first-child {
  white-space: nowrap;
}
.prose .ids td:first-child code {
  overflow-wrap: normal;
}
/* A box that scrolls is a tab stop while it does (site.js), and the ring shows which one the keys move. */
.scroller:focus-visible {
  outline-offset: 2px;
  border-radius: 16px;
}

/* ============================== print ============================== */

@media print {
  .toc {
    display: none;
  }
  .doc {
    display: block;
  }
  .dochead,
  .prose {
    max-width: none;
  }
  .prose {
    font-size: 11pt;
    line-height: 1.5;
  }
  .prose h2,
  .prose h3 {
    break-after: avoid;
  }
  .prose p,
  .prose li,
  .prose tr {
    orphans: 3;
    widows: 3;
  }
  .prose tr {
    break-inside: avoid;
  }
  .prose thead {
    display: table-header-group;
  }
  .scroller {
    overflow: visible;
    border-color: var(--line);
  }
  .prose table {
    min-width: 0;
  }
  .secn {
    width: auto;
    height: auto;
    background: none;
    font-size: inherit;
  }
  /* A link on paper is useless unless its address is printed: the external ones are. (A link to a section of
     this same site reads as «розділі 3» in the sentence, and a mailto link already shows its address.) */
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-weight: 400;
    overflow-wrap: anywhere;
  }
}
