/* Legal pages (pages/legal.js), after vitalrust.com's Terms: a header block with a huge title, then
   a sticky numbered contents list, the text at a comfortable reading width with hairlines between
   sections, and a sticky "In short" panel. One column on phones. Every colour is a palette variable. */

.legal-page { --legal-top: 84px; padding-bottom: 96px; }
.legal-wrap { max-width: 1320px; }

/* ---------------------------------------------------------------- header block */

.legal-head { padding: 48px 0 40px; margin-bottom: 48px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.legal-back {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
}
.legal-back:hover { color: var(--accent-text); }
.legal-back span { font-size: 18px; line-height: 1; }
.legal-title { font-size: clamp(34px, 8vw, 104px); line-height: 0.95; overflow-wrap: anywhere; hyphens: auto; }
.legal-version, .legal-intro { margin: 0; font-size: 15px; color: var(--text-4); }
.legal-intro { max-width: 60ch; font-size: 17px; line-height: 1.6; color: var(--text-3); }
.legal-lang-note { margin: 0; padding: 8px 12px; border: 1px solid var(--line-strong); font-size: 13px; color: var(--text-3); }

/* A value the owner still has to fill in: marked so it cannot be missed. */
.legal-ph { padding: 0 4px; background: var(--accent-tint); outline: 1px dashed var(--accent); color: var(--text); }

/* ---------------------------------------------------------------- three columns */

.legal-grid {
    display: grid; align-items: start; gap: 56px;
    grid-template-columns: 220px minmax(0, 1fr) 280px;
    grid-template-areas: "toc body short";
}
.legal-toc { grid-area: toc; position: sticky; top: var(--legal-top); max-height: calc(100vh - var(--legal-top) - 24px); overflow-y: auto; scrollbar-width: thin; }
.legal-short { grid-area: short; position: sticky; top: var(--legal-top); }
.legal-body { grid-area: body; min-width: 0; max-width: 720px; }

/* Contents: a thin rule on the left; the section being read is marked in the accent. */
.legal-toc-h {
    list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px;
    font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 12px;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4);
}
.legal-toc-h::-webkit-details-marker { display: none; }
.legal-toc-ico { display: none; flex: none; }
.legal-toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line-strong); }
.legal-toc a {
    display: flex; gap: 10px; margin-left: -1px; padding: 7px 0 7px 14px; border-left: 2px solid transparent;
    font-size: 13px; line-height: 1.35; color: var(--text-4); transition: color 0.15s, border-color 0.15s;
}
.legal-toc a:hover { color: var(--text); }
.legal-toc a.is-active { border-left-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.legal-toc-n { min-width: 1.4em; font-variant-numeric: tabular-nums; }

/* In short: a glass panel (site.css .panel) with a left accent bar. */
.legal-short { padding: 26px 24px 30px 28px; box-shadow: inset 3px 0 0 var(--accent); }
.legal-short-h {
    margin: 0 0 16px; font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900;
    font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text);
}
.legal-short ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.legal-short li { position: relative; padding-left: 18px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.legal-short li::before { content: ''; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; background: var(--accent); }
.legal-short a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* The text: numbered sections in the display face, hairlines between them, long lines kept short. */
.legal-sec { padding: 40px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--legal-top) + 8px); }
.legal-sec:first-child { padding-top: 0; border-top: 0; }
.legal-sec:last-child { padding-bottom: 0; }
.legal-h2 {
    margin: 0 0 18px; font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900;
    font-size: clamp(20px, 2vw, 26px); line-height: 1.15; letter-spacing: 0.01em; text-transform: uppercase; color: var(--text);
}
.legal-num { color: var(--accent-text); }
.legal-body p, .legal-body li { font-size: 17px; line-height: 1.75; color: var(--text-2); }
.legal-body p { margin: 0 0 16px; max-width: 68ch; }
.legal-body p:last-child { margin-bottom: 0; }
.legal-body ul, .legal-body ol { margin: 0 0 16px; padding-left: 22px; max-width: 66ch; }
.legal-body li { margin-bottom: 6px; padding-left: 4px; }
.legal-body li::marker { color: var(--accent-text); }
.legal-body a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.legal-body a:hover { color: var(--text); }
.legal-body strong { color: var(--text); font-weight: 700; }

/* ---------------------------------------------------------------- the /legal index */

.legal-cards { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.legal-cards > li { display: flex; }
.legal-card { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 200px; padding: 28px 28px 32px; transition: border-color 0.2s; }
.legal-card:hover { border-color: var(--panel-line-top); color: var(--text); }
.legal-card-n { font-weight: 800; font-size: 12px; letter-spacing: 0.14em; color: var(--text-4); font-variant-numeric: tabular-nums; }
.legal-card-h {
    margin: 0; font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900;
    font-size: 22px; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; hyphens: auto; color: var(--text);
}
.legal-card-p { font-size: 15px; line-height: 1.55; color: var(--text-3); }
.legal-card-go { margin-top: auto; padding-top: 8px; color: var(--accent); transition: transform 0.15s; }
.legal-card:hover .legal-card-go { transform: translateX(4px); }

/* ---------------------------------------------------------------- narrower screens */

/* Up to 1240 px the header has two rows. */
@media (max-width: 1240px) {
    .legal-page { --legal-top: 116px; }
}
/* Two columns: the contents on the left, "In short" above the text. */
@media (max-width: 1180px) {
    .legal-grid { grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "toc short" "toc body"; gap: 40px 48px; }
    .legal-short { position: static; max-width: 720px; }
    .legal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones: one column. The contents fold away at the top (assets/legal.js closes them), then
   "In short", then the text. */
@media (max-width: 860px) {
    .legal-page { --legal-top: 72px; padding-bottom: 64px; }
    .legal-head { padding: 32px 0 28px; margin-bottom: 28px; }
    .legal-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "toc" "short" "body"; gap: 24px; }
    .legal-toc { position: static; max-height: none; overflow: visible; }
    .legal-toc-box { border: 1px solid var(--panel-line); border-top-color: var(--panel-line-top); background: var(--panel-bg); }
    .legal-toc-h { margin: 0; min-height: 52px; padding: 0 16px; cursor: pointer; color: var(--text); }
    .legal-toc-ico { display: block; transition: transform 0.15s; }
    .legal-toc-box[open] .legal-toc-ico { transform: rotate(180deg); }
    .legal-toc-box ol { margin: 0 16px 16px; }
    .legal-short { padding: 22px 20px 26px 24px; }
    .legal-body p, .legal-body li { font-size: 16px; }
    .legal-sec { padding: 32px 0; }
    .legal-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .legal-card { min-height: 0; padding: 22px 22px 26px; }
}
