/*
 * Privacy policy and terms of service. Loaded through
 * site_page(['page_css' => ...]) after assets/style.css, so it uses the tokens
 * defined there. Markup comes from includes/legal.php.
 */

/* ---------- Hero ---------- */
.is-legal .page-hero-split { grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 56px; padding: 44px 64px 52px; }
.is-legal .page-title { max-width: 14ch; }
.is-legal .hero-description { max-width: 50ch; }

.legal-meta {
  margin-top: 36px; padding-top: 24px; border-top: 1px solid rgba(23, 22, 28, .08);
  display: flex; flex-wrap: wrap; gap: 16px 44px; max-width: 540px;
}
.legal-meta dt { font-size: .84rem; color: var(--slate); }
.legal-meta dd { margin-top: 2px; font-size: 1.4rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.legal-actions { margin-top: 30px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.legal-actions .text-link { font-size: .96rem; }

/* At a glance card */
.legal-glance {
  padding: 10px; border-radius: 28px;
  background: rgba(255, 255, 255, .78); border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 30px 60px -40px rgba(23, 22, 28, .45);
}
.legal-glance-art { border-radius: 20px; overflow: hidden; background: #eef9f5; }
.legal-art { display: block; width: 100%; height: auto; }
.legal-glance-body { padding: 14px 14px 2px; }
.legal-glance-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px; }
.legal-glance-head h2 { font-size: 1.06rem; font-weight: 600; letter-spacing: -.02em; }
.legal-glance-head span { font-size: .84rem; color: var(--slate); }
.legal-glance-list { list-style: none; margin-top: 4px; }
.legal-glance-list li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 7px 4px; font-size: .93rem; line-height: 1.36; color: #2b2a33;
}
.legal-glance-list li + li { border-top: 1px dashed #e7ecec; }
.legal-glance-list svg { width: 22px; height: 22px; }
.legal-glance-list span { text-wrap: pretty; }
.legal-glance-list a {
  min-width: 32px; padding: 2px 8px; border-radius: 999px; text-align: center;
  background: var(--mist); color: var(--slate); font-size: .78rem; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background-color .15s, color .15s;
}
.legal-glance-list a:hover { background: var(--violet-soft); color: var(--violet-on-soft); }

/* ---------- Body: contents list beside the sections ---------- */
.legal-layout {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; align-items: start;
  padding-top: 48px;
}
.legal-aside {
  position: sticky; top: 20px; display: grid; gap: 14px;
  max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: thin;
}
.legal-toc { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 18px 12px 12px; }
/* Desktop shows a plain label; the summary only appears where the list folds. */
.legal-toc-label {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 10px; font-size: .86rem; font-weight: 500; color: var(--slate);
}
.legal-toc-label span + span { font-size: .8rem; color: var(--faint-text); font-weight: 400; }
.legal-toc-title { display: none; list-style: none; }
.legal-toc-title::-webkit-details-marker { display: none; }
@media (min-width: 1081px) {
  .legal-toc details::details-content { content-visibility: visible; display: block; }
}
.legal-toc ol { list-style: none; margin-top: 10px; display: grid; gap: 2px; }
.legal-toc a {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px;
  padding: 9px 10px; border-radius: 10px;
  font-size: .92rem; line-height: 1.35; color: #3a3f4a;
  transition: background-color .15s, color .15s;
}
.legal-toc a span { font-size: .78rem; line-height: 1.75; color: var(--faint-text); font-variant-numeric: tabular-nums; }
.legal-toc a:hover { background: var(--mist); color: var(--ink); }
.legal-toc a[aria-current="true"] { background: var(--violet-soft); color: var(--ink); font-weight: 500; }
.legal-toc a[aria-current="true"] span { color: var(--violet-on-soft); }

.legal-other {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 18px; gap: 14px; align-items: center;
  padding: 16px; border-radius: 20px;
  background: linear-gradient(180deg, #f0fbf7, #f7fbfa); border: 1px solid #d8efe7;
  transition: border-color .15s;
}
.legal-other:hover { border-color: #b9e6d6; }
.legal-other-glyph { width: 44px; height: 44px; }
.legal-other strong { display: block; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; color: var(--ink); }
.legal-other strong + span { display: block; margin-top: 2px; font-size: .86rem; line-height: 1.35; color: var(--slate); }
.legal-other-go { width: 18px; height: 18px; color: var(--faint); transition: transform .15s, color .15s; }
.legal-other:hover .legal-other-go { color: var(--violet); transform: translateX(3px); }

/* The document: one surface, a numbered row per section. */
.legal-doc {
  min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 48px; color: #33373f; font-size: 1.04rem;
}
.legal-section {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "num head" "num body";
  column-gap: 24px; row-gap: 12px; align-items: start;
  padding: 36px 0; scroll-margin-top: 24px;
}
.legal-section + .legal-section { border-top: 1px solid var(--line); }
.legal-num {
  grid-area: num; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: var(--mist); color: var(--ink);
  font-size: .98rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.legal-section:target .legal-num,
.legal-section:hover .legal-num { background: var(--violet-soft); color: var(--violet-on-soft); }
.legal-section > h2 {
  grid-area: head; align-self: center; max-width: 44rem;
  font-size: 1.4rem; line-height: 1.2; letter-spacing: -.03em; font-weight: 600; color: var(--ink);
}
.legal-section-body { grid-area: body; max-width: 44rem; }
.legal-section-body > * + * { margin-top: 14px; }
.legal-section-body p { text-wrap: pretty; }
.legal-section-body a:not(.text-link) { color: var(--violet-text); border-bottom: 1px solid rgba(123, 92, 240, .35); }
.legal-section-body a:not(.text-link):hover { border-bottom-color: var(--violet); }
.legal-domain { font: .92em var(--mono); background: var(--mist); padding: 0 3px; border-radius: 5px; }

/* Server log fields: a quiet list with violet markers. */
.legal-list { list-style: none; display: grid; gap: 8px; padding: 16px 20px; border-radius: 16px; background: #fafbfb; border: 1px solid var(--line); }
.legal-list li { position: relative; padding-left: 20px; }
.legal-list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--violet); }

/* Rules of use: a row per rule with an amber stop glyph. */
.legal-rules { list-style: none; display: grid; gap: 10px; }
.legal-rules li {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 14px 18px; border-radius: 16px; background: #fafbfb; border: 1px solid var(--line);
}
.legal-rules li::before {
  content: ""; width: 26px; height: 26px; border-radius: 50%; margin-top: -1px;
  background:
    linear-gradient(var(--amber), var(--amber)) center / 11px 2.4px no-repeat,
    var(--amber-soft);
  box-shadow: inset 0 0 0 2px var(--amber-ring);
}

/* ---------- Closing band ---------- */
.legal-close {
  margin-top: 56px; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 20px 56px; align-items: center;
  padding: 36px 40px; border-radius: var(--radius-md); color: #fff; position: relative; overflow: hidden; isolation: isolate;
  background: #17161c;
}
.legal-close::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .2) 1px, transparent 1.4px);
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(50% 80% at 85% 20%, #000, transparent);
  mask-image: radial-gradient(50% 80% at 85% 20%, #000, transparent);
}
.legal-close h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.legal-close p { margin-top: 8px; color: rgba(255, 255, 255, .72); font-size: .96rem; }
.legal-close .text-link { color: #fff; border-bottom-color: rgba(255, 255, 255, .45); }
.legal-close .text-link:hover { border-bottom-color: #fff; }
.legal-bar { margin-top: 0; max-width: none; color: var(--ink); }
.legal-bar input { padding: 15px 6px; font-size: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .is-legal .page-hero-split { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 36px; padding: 40px 40px 44px; }
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 40px; }
  .legal-aside { position: static; max-height: none; overflow: visible; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  /* Below the two-column layout the contents list folds (app.js closes it). */
  .legal-toc { padding: 14px 12px; }
  .legal-toc-label { display: none; }
  .legal-toc-title {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    cursor: pointer; padding: 2px 10px; font-size: .96rem; font-weight: 500; color: var(--ink);
  }
  .legal-toc-title span { display: inline-flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--slate); }
  .legal-toc-title span::after { content: "+"; font: 400 1.3rem var(--mono); line-height: 1; color: var(--violet); transition: transform .2s; }
  .legal-toc details[open] .legal-toc-title span::after { transform: rotate(45deg); }
  .legal-close { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .is-legal .page-hero-split { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

@media (max-width: 760px) {
  .is-legal .page-hero-split { padding: 28px 20px 32px; gap: 24px; }
  .legal-meta { margin-top: 24px; padding-top: 18px; gap: 12px 28px; }
  .legal-meta dd { font-size: 1.2rem; }
  .legal-glance { padding: 7px; border-radius: 22px; }
  .legal-glance-art { border-radius: 16px; }
  .legal-art-label { display: none; }
  .legal-glance-body { padding: 14px 8px 2px; }
  .legal-glance-list li { font-size: .92rem; gap: 10px; }
  .legal-layout { padding-top: 28px; }
  .legal-aside { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .legal-toc { padding: 12px 8px; }
  .legal-doc { padding: 4px 20px; font-size: 1rem; }
  .legal-section { grid-template-columns: 38px minmax(0, 1fr); grid-template-areas: "num head" "body body"; column-gap: 14px; row-gap: 14px; padding: 28px 0; }
  .legal-num { width: 38px; height: 38px; border-radius: 12px; font-size: .88rem; }
  .legal-section > h2 { font-size: 1.22rem; }
  .legal-list { padding: 14px 16px; }
  .legal-rules li { padding: 12px 14px; gap: 12px; }
  .legal-close { margin-top: 40px; padding: 26px 20px; }
  .legal-bar { flex-wrap: wrap; padding: 6px; }
  .legal-bar > svg { display: none; }
  .legal-bar input { flex: 1 1 100%; padding: 12px 12px; }
  .legal-bar .btn-violet { flex: 1 1 100%; padding: 13px 20px; }
}
