/* =====================================================================
   READING PAGES — the legal pages, the FAQ, custom pages and the maintenance screen in the approved Keycard
   prototype's page frame. Markup: snippets/read-legal.njk (terms-page, privacy-policy-page, refund-policy-page,
   legal-page), components/faq.njk, templates/custom-page.njk, templates/maintenance.njk; all link this file
   through snippets/read-base.njk. Behaviour: assets/pages-read.js. The frame, the head and the tokens are
   site.css (KEYCARD PAGES); the backdrop and its calm line field kc-field.css / .js.
   The legal page is mock/store2/keycard/legal.html, its rules verbatim (shared/pages.css "legal"); the shop's
   real text replaces the prototype's placeholder sections and grey bars. The FAQ, custom pages and maintenance
   have no page of their own in the prototype: they are built from the same parts. Additions to the
   prototype's rules are marked "(theme)".
   ===================================================================== */

/* =====================================================================
   LEGAL PAGE (shared/pages.css): the sections left, the title and the text in the middle, "About this page"
   and the legal pages right
   ===================================================================== */
.pg-legal .pg-head { grid-column: 2 / 3; }
.pg-toc { grid-column: 1; grid-row: 1 / 3; align-self: start; position: sticky; top: calc(var(--bar) + 40px); border-bottom: 1px solid var(--line); }
.pg-toc a { display: grid; grid-template-columns: 34px 1fr; align-items: center; height: 48px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--dim); }
.pg-toc a .num { font-size: 11.5px; letter-spacing: 0.1em; color: var(--ghost); }
.pg-toc a.is-on { color: #fff; }
.pg-toc a.is-on .num { color: #fff; }
.pg-toc-h { margin-bottom: 18px; }
.pg-doc { grid-column: 2; grid-row: 2; max-width: 760px; margin-top: 40px; }
.pg-aside { grid-column: 3; grid-row: 1 / 3; align-self: start; }
.pg-aside dl { margin-top: 18px; border-bottom: 1px solid var(--line); }
.pg-aside dl > div { display: grid; grid-template-columns: 110px 1fr; align-items: center; min-height: 46px; border-top: 1px solid var(--line); font-size: 14.5px; }
.pg-aside dt { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.pg-aside .pg-links { margin-top: 26px; }
.pg-aside .pg-links a { display: flex; justify-content: space-between; align-items: center; height: 46px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--dim); }
.pg-aside .pg-links a.is-on { color: #fff; }
.pg-aside .pg-links a svg { width: 14px; height: 14px; stroke-width: 2; }

/* (theme) the shop's sections have real names: a long one takes a second line; a long list scrolls in itself;
   a pointer lights a row as the bar's links do; the keyboard's ring lies inside the row */
.pg-toc a { height: auto; min-height: 48px; padding: 7px 0; line-height: 1.3; transition: color 0.2s ease; }
.pg-toc { max-height: calc(100vh - var(--bar) - 80px); overflow-y: auto; scrollbar-width: none; }
.pg-toc::-webkit-scrollbar { display: none; }
.pg-toc a:hover, .pg-aside .pg-links a:hover { color: #fff; }
.pg-aside .pg-links a { transition: color 0.2s ease; }
.pg-toc a:focus-visible, .pg-aside .pg-links a:focus-visible { outline-offset: -2px; }
/* (theme) the right column stays in view beside a long text, as the sections do */
.pg-aside { position: sticky; top: calc(var(--bar) + 40px); }
.pg-aside dd { min-width: 0; }
.rd-toc-btn { display: none; }

/* ---------- the shop's text, exactly as delivered (rich text: h2, p, lists, links, strong ...): the prototype's
   sections (a heading of 20 px with its number, then 15 px text, 40 px between sections); the numbers are
   drawn, the text is not touched ---------- */
.rd-text { font-size: 15px; line-height: 1.6; color: var(--dim); overflow-wrap: break-word; counter-reset: rd-sec; }
.rd-text :where(p, ul, ol, blockquote, table, pre, figure) { margin: 0 0 14px; }
.rd-text p:empty { display: none; }
.rd-text :where(h1, h2) { margin: 40px 0 16px; font-size: 20px; line-height: 1.3; color: var(--ink); scroll-margin-top: calc(var(--bar) + 28px); }
.rd-text h2 { counter-increment: rd-sec; }
.rd-text h2::before { content: counter(rd-sec, decimal-leading-zero); display: inline-block; margin-right: 18px; font-size: 12px; letter-spacing: 0.1em; color: var(--ghost); }
.rd-text > :first-child { margin-top: 0; }
.rd-text h3 { margin: 28px 0 10px; font-size: 16.5px; line-height: 1.35; color: var(--ink); }
.rd-text :where(h4, h5, h6) { margin: 22px 0 8px; font-size: 15px; line-height: 1.4; color: var(--ink); }
.rd-text ul > li { position: relative; padding-left: 20px; }
.rd-text ul > li::before { content: ''; position: absolute; left: 0; top: 0.8em; width: 10px; height: 1px; background: var(--line-3); }
.rd-text ol { counter-reset: rd-ol; }
.rd-text ol > li { position: relative; padding-left: 30px; counter-increment: rd-ol; }
.rd-text ol > li::before { content: counter(rd-ol, decimal-leading-zero); position: absolute; left: 0; top: 0.3em; font-size: 11.5px; line-height: 1.4; letter-spacing: 0.1em; color: var(--ghost); }
.rd-text li + li { margin-top: 6px; }
.rd-text li > :where(ul, ol) { margin: 6px 0 0; }
.rd-text a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 3px; transition: text-decoration-color 0.2s ease; }
.rd-text a:hover { text-decoration-color: #fff; }
.rd-text :where(strong, b) { color: var(--ink); }
.rd-text blockquote { padding-left: 18px; border-left: 1px solid var(--line-3); }
.rd-text hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); opacity: 1; }
.rd-text img { height: auto; }
.rd-text table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.rd-text :where(th, td) { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rd-text th { color: var(--ink); }

/* =====================================================================
   FAQ — the legal page's twin: the questions left (lit while read), the owner's title and line in the middle
   with the questions as numbered rows under it, the help pages right
   ===================================================================== */
.rd-faq { border-bottom: 1px solid var(--line); }
.rd-qa { border-top: 1px solid var(--line); scroll-margin-top: calc(var(--bar) + 28px); }
.rd-faq h2 { margin: 0; font-size: inherit; }
/* the question: its number, its words, the drawn plus; the height comes from padding (baseline alignment) */
.rd-q { display: grid; grid-template-columns: 34px minmax(0, 1fr) 14px; align-items: baseline; column-gap: 0; width: 100%; padding: 22px 0; font-size: 20px; line-height: 1.3; text-align: left; color: var(--ink); transition: color 0.2s ease; }
.rd-q .num { font-size: 12px; letter-spacing: 0.1em; color: var(--ghost); transition: color 0.2s ease; }
.rd-q > span + span { padding-right: 24px; }
.rd-q .rd-x { align-self: center; color: var(--dim); transition: color 0.2s ease; }
.rd-q:hover, .rd-qa.is-open .rd-q { color: #fff; }
.rd-q:hover .rd-x, .rd-qa.is-open .rd-x, .rd-qa.is-open .rd-q .num { color: #fff; }
.rd-q:focus-visible { outline-offset: -2px; }
/* the answer: the owner's text with its own line breaks; opens by growing to its height while it rises in, as a
   view of the store does (store.css kc-rise: 8 px, 0.55 s) */
.rd-a { display: grid; grid-template-rows: 1fr; }
.rd-a-in { min-height: 0; overflow: hidden; }
.rd-a-txt { max-width: 64ch; padding: 0 30px 26px 34px; font-size: 15px; line-height: 1.6; color: var(--dim); white-space: pre-line; overflow-wrap: break-word; }
.rd-a-txt a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 3px; }
.rd-a-txt a:hover { text-decoration-color: #fff; }
html.rd-js .rd-a { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 0.45s var(--ease), visibility 0s linear 0.45s; }
html.rd-js .rd-qa.is-open .rd-a { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.45s var(--ease), visibility 0s; }
html.rd-js .rd-qa.is-open .rd-a-txt { animation: rd-rise 0.55s var(--ease) both; }
@keyframes rd-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* the help pages stand where the legal page's facts begin */
.pg-faq .pg-aside .pg-links { margin-top: 18px; }
/* the questions on the left are one line each */
.pg-faq .pg-toc a > span + span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* the quiet way on at the end */
.rd-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 32px; font-size: 15px; color: var(--faint); }

/* the drawn plus of a closed disclosure; open, its upright bar draws together into the middle and it is a minus.
   The bar shortens (its height and top, painted) rather than turns or scales: an animated turn or scale is a
   layer of its own whose drawing program the graphics card first has to prepare (one frame of 20 to 30 ms at the
   first opening, measured) */
.rd-x { position: relative; flex: none; width: 14px; height: 14px; }
.rd-x::before, .rd-x::after { content: ''; position: absolute; background: currentColor; }
.rd-x::before { left: 0; top: 6.5px; width: 14px; height: 1px; }
.rd-x::after { left: 6.5px; top: 0; width: 1px; height: 14px; transition: top 0.35s var(--ease), height 0.35s var(--ease); }
.rd-qa.is-open .rd-x::after, .rd-toc.is-open .rd-x::after { top: 7px; height: 0; }

/* =====================================================================
   CUSTOM PAGE — the page's name in the frame's head; the owner's components follow below it in their own look
   ===================================================================== */
.pg-custom { grid-template-rows: auto; min-height: 0; padding-bottom: 44px; }
.pg-custom .pg-head { grid-column: 1 / -1; }
/* the owner's components lie over the same backdrop, above it */
.rd-custom > .components { position: relative; z-index: 2; }

/* =====================================================================
   MAINTENANCE — one screen without the bar and the footer: the name and "Admin access" in the bar's place,
   the shop's message in the middle in the frame's head, the calm field around it
   ===================================================================== */
.kc-pg.rd-maint { min-height: 100vh; min-height: 100svh; }
.rd-maint .kc-back { top: 0; height: 100%; }
.rd-maint-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--bar); padding: 0 var(--gut); border-bottom: 1px solid var(--line); }
.rd-brand { display: inline-flex; align-items: center; gap: 12px; height: 40px; }
.rd-brand img { width: 40px; height: 40px; object-fit: contain; filter: brightness(1.6); }
.rd-brand span { font-size: 17px; line-height: 1; letter-spacing: 0.12em; white-space: nowrap; color: #fff; }
.rd-maint-in { position: relative; z-index: 2; display: grid; place-content: center; min-height: calc(100vh - var(--bar)); min-height: calc(100svh - var(--bar)); padding: 40px var(--gut) 72px; }
.rd-maint-in .pg-head { max-width: 760px; }
.rd-maint-in .sx-btn { margin-top: 28px; }
@media (max-width: 760px) {
  .rd-maint-top { padding: 0 12px 0 14px; }
  .rd-brand { gap: 10px; }
  .rd-brand img { width: 32px; height: 32px; }
  .rd-brand span { font-size: 14.5px; letter-spacing: 0.1em; }
}

/* =====================================================================
   (theme) PHONES AND TABLETS: the head, the sections (a button opens them), the text, "About this page"
   ===================================================================== */
@media (max-width: 1099px) {
  /* one column: every part as wide as the page (on wide windows they keep to the top of their grid cells) */
  .pg-head, .pg-toc, .pg-doc, .pg-aside { align-self: stretch; }
  .pg-legal .pg-head { order: 1; }
  .pg-toc { order: 2; position: static; max-height: none; margin-top: 28px; overflow: visible; border-bottom: 0; }
  .pg-doc { order: 3; margin-top: 32px; }
  .pg-aside { order: 4; position: static; margin-top: 48px; }
  .pg-toc-h { display: none; }
  .rd-toc-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.03);
    font-size: 15px;
    text-align: left;
    color: var(--ink);
  }
  .rd-toc-btn > .num { margin-right: auto; font-size: 11.5px; letter-spacing: 0.1em; color: var(--ghost); }
  .rd-toc-btn:focus-visible { outline-offset: -2px; }
  .rd-toc-list { padding: 0 16px; border: 1px solid var(--line-2); border-top: 0; }
  .rd-toc-list a:first-child { border-top: 0; }
  /* closed until opened, only when the script is there to open them */
  html.rd-js .rd-toc:not(.is-open) .rd-toc-list { display: none; }
  /* the FAQ's questions are the list itself on a narrow screen */
  .pg-faq .pg-toc { display: none; }
}
@media (max-width: 760px) {
  .rd-text { font-size: 15px; }
  .rd-text :where(h1, h2) { margin-top: 36px; font-size: 19px; }
  .rd-text h2::before { margin-right: 14px; }
  .rd-q { grid-template-columns: 30px minmax(0, 1fr) 14px; padding: 20px 0; font-size: 17px; }
  .rd-q > span + span { padding-right: 16px; }
  .rd-a-txt { padding: 0 6px 22px 30px; }
  .pg-aside dl > div { grid-template-columns: 100px 1fr; }
}