/* Legal and support pages: a readable document on the same paper as the landing page.
   Each page holds two articles, lang="en" and lang="ro"; only the chosen language shows.
   Wide screens: the title and short version across the top, then a sticky contents rail beside the text. */
html[lang="en"] .doc article[lang="ro"], html[lang="ro"] .doc article[lang="en"] { display: none; }

.doc { padding-block: 2rem 5rem; }
.doc article { display: grid; grid-template-columns: minmax(0, 44rem); justify-content: center; animation: enter var(--dur) var(--ease); }
.doc article > * + * { margin-top: 1rem; }
.doc h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.05; }
.doc h2 { font: 500 1.75rem/1.2 var(--serif); margin-top: 3rem; padding-top: 2.25rem; border-top: 1px solid var(--hairline); scroll-margin-top: 5rem; }
.doc h3 { font: 600 1.15rem/1.3 var(--serif); margin-top: 1.6rem; }
.doc h3 + * { margin-top: .6rem; }
.doc p, .doc li { font-size: 1.0625rem; line-height: 1.7; }
.doc ul, .doc ol { margin: 0; padding-left: 1.3rem; display: grid; gap: .45rem; }
.doc li::marker { color: var(--edge-ink); }
.doc a { color: var(--text); text-decoration-thickness: 1.5px; text-decoration-color: var(--edge-ink); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: currentColor; }
.doc strong { font-weight: 650; }
.doc__meta { color: var(--muted); font-size: .9375rem !important; margin-top: .75rem !important; }
.doc__lead { font: 400 1.3rem/1.55 var(--serif) !important; color: var(--muted); max-width: 40rem; margin-top: 1.5rem !important; }

/* tabs between the three documents */
.doc__tabs { display: flex; gap: .25rem; width: fit-content; max-width: 100%; margin: 0 auto 2.5rem; padding: .25rem; border-radius: 999px; background: var(--sunken); box-shadow: var(--elev); }
.doc__tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border-radius: 999px; color: var(--muted); font: 600 .9375rem var(--sans); text-decoration: none; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), scale var(--dur-fast) var(--ease); }
.doc__tabs a:hover { color: var(--text); }
.doc__tabs a:active { scale: .98; }
.doc__tabs a[aria-current="page"] { background: var(--ink); color: var(--on-ink); box-shadow: var(--elev); }

/* the short version, at the top */
.doc__summary { list-style: none; padding: 0 !important; display: grid; gap: .75rem !important; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin-top: 2rem !important; counter-reset: s; }
.doc__summary li { position: relative; padding: 1.15rem 1.2rem 1.2rem 3.4rem; border-radius: var(--blob-s); background: var(--sheet); box-shadow: var(--elev); font-size: 1rem !important; line-height: 1.5 !important; counter-increment: s; transition: box-shadow var(--dur) var(--ease); }
.doc__summary li:hover { box-shadow: var(--elev-hover); }
.doc__summary li::before { content: ""; position: absolute; left: 1.2rem; top: 1.3rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--state); box-shadow: inset 0 0 0 1.5px var(--edge-ink); }
.doc__summary li::after { content: ""; position: absolute; left: 1.58rem; top: 1.62rem; width: .3rem; height: .55rem; border: solid var(--ink); border-width: 0 2px 2px 0; rotate: 45deg; } /* drawn tick */
.doc__summary:has(a) li { padding-left: 1.2rem; } /* support: ways to reach us, not promises, so no ticks */
.doc__summary:has(a) li::before, .doc__summary:has(a) li::after { content: none; }
.doc__summary b { display: block; font: 600 1.1rem/1.3 var(--serif); margin-bottom: .25rem; }

@media (min-width: 40rem) { .doc__summary:has(> li:nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); } } /* even rows, never an orphan */
@media (min-width: 52rem) { .doc__summary:has(> li:nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr); } }

/* contents */
.doc__toc { padding: 1.1rem 1.25rem; border-radius: var(--blob-s); background: var(--sunken); margin-top: 2rem !important; }
.doc__toc::before { content: "On this page"; display: block; font: 700 .8125rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .6rem; }
html[lang="ro"] .doc__toc::before { content: "Pe această pagină"; }
.doc__toc ol { columns: 2 14rem; display: block; padding-left: 1.4rem; }
.doc__toc li { margin-bottom: .3rem; font-size: .9375rem !important; line-height: 1.4 !important; }
.doc__toc a { text-decoration: none; }
.doc__toc a:hover { text-decoration: underline; }

/* questions and answers: one grouped list, each row opens in place */
.doc { interpolate-size: allow-keywords; }
.doc details { background: var(--sheet); box-shadow: var(--elev); }
.doc details + details { margin-top: 0; border-top: 1px solid var(--hairline); }
.doc :not(details) + details { border-radius: 1.1rem 1.1rem 0 0; margin-top: 1.25rem; }
.doc details:not(:has(+ details)) { border-radius: 0 0 1.1rem 1.1rem; }
.doc :not(details) + details:not(:has(+ details)) { border-radius: 1.1rem; }
.doc summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; padding: .7rem 1.2rem; font: 600 1.0625rem/1.4 var(--sans); cursor: pointer; list-style: none; border-radius: inherit; }
.doc summary::-webkit-details-marker { display: none; }
.doc summary::after { content: ""; flex: none; width: .55rem; height: .55rem; margin-right: .2rem; border: solid var(--muted); border-width: 0 2px 2px 0; rotate: 45deg; translate: 0 -.15rem; transition: rotate var(--dur) var(--ease), translate var(--dur) var(--ease); }
.doc details[open] summary::after { rotate: 225deg; translate: 0 .15rem; }
.doc summary:hover { background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.doc details > :not(summary) { padding: 0 1.2rem; }
.doc details > :last-child { padding-bottom: 1.1rem; }
.doc details::details-content { block-size: 0; overflow: clip; transition: block-size var(--dur) var(--ease), content-visibility var(--dur) allow-discrete; }
.doc details[open]::details-content { block-size: auto; }

/* tables (what data, why, how long) */
.doc__table { width: 100%; border-collapse: collapse; font-size: .9375rem; background: var(--sheet); border-radius: var(--blob-s); overflow: hidden; box-shadow: var(--elev); }
.doc__table caption { text-align: left; margin-bottom: .5rem; }
.doc__table th, .doc__table td { text-align: left; vertical-align: top; padding: .75rem .9rem; border-bottom: 1px solid var(--hairline); line-height: 1.5; }
.doc__table th { font: 600 .875rem var(--sans); background: var(--sunken); }
.doc__table td:first-child { font-weight: 600; }
.doc__table tr:last-child td { border-bottom: 0; }
.doc__scroll { overflow-x: auto; }

/* notes */
.doc__note { padding: 1rem 1.2rem; border-radius: var(--blob-s); background: var(--mint); font-size: 1rem !important; }
.doc__draft { justify-self: start; display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .85rem; border-radius: 1rem; background: var(--nappy); font: 600 .875rem var(--sans) !important; margin-top: 1rem !important; }
.doc__draft::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--rule); }
.doc__todo { background: var(--butter); padding: 0 .3rem; border-radius: .3rem; font-weight: 600; } /* a detail the owner must fill in */

/* wide: contents rail on the left, sticky, marking the section being read */
@media (min-width: 64rem) {
  .doc article { grid-template-columns: 14rem minmax(0, 44rem); column-gap: 4.5rem; }
  .doc article > * { grid-column: 2; }
  .doc article > :is(h1, .doc__meta, .doc__draft, .doc__lead, .doc__summary) { grid-column: 1 / -1; }
  /* shortcut: the rail spans 300 rows so it sits beside every section; raise it if a page ever has more top-level blocks */
  .doc article > .doc__toc { grid-column: 1; grid-row: span 300; align-self: start; position: sticky; top: 6rem; margin-top: 3rem !important; padding: 0; background: none; border-radius: 0; }
  .doc__toc ol { columns: auto; list-style: none; padding: 0; border-left: 2px solid var(--hairline); }
  .doc__toc li { margin: 0; }
  .doc__toc a { display: block; margin-left: -2px; padding: .4rem 0 .4rem 1rem; border-left: 2px solid transparent; color: var(--muted); transition: color var(--dur-fast) var(--ease), border-color var(--dur) var(--ease); }
  .doc__toc a:hover { color: var(--text); text-decoration: none; }
  .doc__toc a[aria-current="location"] { color: var(--text); font-weight: 600; border-left-color: var(--ink); }
  .doc article > h2:first-of-type { margin-top: 3rem; }
}

/* footer links on every page */
.foot__links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; list-style: none; margin: 0; padding: 0; }
.foot__links a { color: inherit; text-underline-offset: 3px; min-height: 44px; display: inline-flex; align-items: center; }
.foot__links a[aria-current="page"] { color: var(--text); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .doc article { animation: none; }
  .doc__tabs a, .doc__toc a, .doc__summary li, .doc summary::after, .doc details::details-content { transition: none; }
}
