/* =========================================================
   Console Crew — Legal pages (Privacy Policy, Terms of Service)
   Loads after home.css and reuses its tokens, header and footer.
   ========================================================= */

.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- hero ---------- */
.legal-hero { padding: calc(72px + var(--s8)) 0 var(--s7); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .85rem; color: var(--faint); margin-bottom: var(--s5); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: #fff; }
.crumbs i { font-size: .6rem; }
.legal-hero h1 { font-size: clamp(2.4rem, 5vw, 3.75rem); margin-bottom: var(--s4); }
.legal-hero .lead { margin-bottom: var(--s5); }
.meta-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s5); }
.meta-chips > span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill); font-size: .8125rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.meta-chips i { color: var(--cyan); font-size: .8rem; }
.hero-tools { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---------- at a glance ---------- */
.glance { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); margin-bottom: var(--s8); }
.glance a {
  display: flex; flex-direction: column; gap: 10px; padding: var(--s5); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s var(--ease), border-color .25s, background-color .25s;
}
.glance a:hover { transform: translateY(-3px); border-color: var(--border-strong); background: var(--surface-hover); }
.glance i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.06); color: var(--cyan); }
.glance b { font-family: var(--font-display); color: #fff; font-size: 1rem; line-height: 1.3; }
.glance span { color: var(--muted); font-size: .85rem; line-height: 1.5; }

/* ---------- layout ---------- */
.legal-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s8); align-items: start; }
.toc { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.toc::-webkit-scrollbar { width: 6px; }
.toc::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 6px; }
.toc summary { list-style: none; cursor: default; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: var(--s3); display: flex; align-items: center; justify-content: space-between; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary .chev { display: none; }
.toc ol { list-style: none; border-left: 1px solid var(--border); }
.toc a {
  display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: .875rem; line-height: 1.4; color: var(--muted); transition: color .2s, border-color .2s;
}
.toc a:hover { color: #fff; }
.toc a.active { color: #fff; border-left-color: var(--cyan); }
.toc .toc-progress { margin-top: var(--s5); height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.toc .toc-progress i { display: block; height: 100%; width: 0; background: var(--grad); }

/* ---------- article ---------- */
.legal-body { max-width: 780px; font-size: 1rem; line-height: 1.75; color: #C9D0DF; }
.legal-body > section { padding: var(--s7) 0; border-top: 1px solid var(--border); scroll-margin-top: 96px; }
.legal-body > section:first-child { border-top: 0; padding-top: 0; }
.legal-body h2 {
  display: flex; align-items: center; gap: var(--s3);
  font-size: clamp(1.4rem, 2.4vw, 1.75rem); line-height: 1.25; margin-bottom: var(--s4);
}
.legal-body h2 .h-ico {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: .95rem; color: var(--tone, var(--cyan));
  background: color-mix(in srgb, var(--tone, var(--cyan)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--cyan)) 30%, transparent);
}
.legal-body h2 .anchor-link { margin-left: auto; opacity: 0; font-size: .85rem; color: var(--faint); padding: 8px; border-radius: 8px; transition: opacity .2s, color .2s; }
.legal-body h2:hover .anchor-link, .anchor-link:focus-visible { opacity: 1; }
.anchor-link:hover { color: #fff; }
.anchor-link.copied { color: var(--cyan); opacity: 1; }
.legal-body h3 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: var(--s2); }
.legal-body h3 i { color: var(--tone, var(--cyan)); font-size: .95em; }
.legal-body p + p, .legal-body p + ul, .legal-body ul + p, .legal-body .callout + p, .legal-body p + .callout,
.legal-body .callout + ul, .legal-body ul + .callout, .legal-body .callout + .callout, .legal-body .split + p, .legal-body p + .split,
.legal-body .split + .callout, .legal-body .callout + .split, .legal-body p + .rights { margin-top: var(--s4); }
.legal-body strong { color: #fff; font-weight: 600; }
.legal-body a { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(34,211,238,.4); text-underline-offset: 3px; }
.legal-body a:hover { text-decoration-color: var(--cyan); }
.legal-body ul { list-style: none; }
.legal-body ul li { position: relative; padding-left: 22px; }
.legal-body ul li + li { margin-top: 8px; }
.legal-body ul li::before { content: ''; position: absolute; left: 4px; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--tone, var(--violet)); opacity: .8; }

/* yes / no lists */
.legal-body ul li.yes, .legal-body ul li.no { padding-left: 30px; }
.legal-body ul li.yes::before, .legal-body ul li.no::before {
  font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .65rem; line-height: 18px; text-align: center;
  width: 18px; height: 18px; left: 0; top: .32em; border-radius: 50%; opacity: 1; background: none;
}
.legal-body ul li.yes::before { content: '\f00c'; color: #34D399; background: rgba(52,211,153,.14); }
.legal-body ul li.no::before { content: '\f00d'; color: #F87171; background: rgba(248,113,113,.14); }

/* callouts */
.callout {
  --tone: var(--cyan);
  position: relative; padding: var(--s5); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--tone) 7%, rgba(255,255,255,.02));
  border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
}
.callout::before { content: ''; position: absolute; left: -1px; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--tone); }
.callout h3 { color: #fff; }
.callout.ok { --tone: #34D399; }
.callout.warn { --tone: #FBBF24; }
.callout.danger { --tone: #F87171; }
.callout.info { --tone: #A78BFA; }
.callout.blue { --tone: #60A5FA; }
.callout .legalese { font-size: .95rem; letter-spacing: .01em; }

/* stacked callouts (e.g. compliance list) */
.stack { display: grid; gap: var(--s3); }
.stack + p, p + .stack { margin-top: var(--s4); }

/* two-column yes / no */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.split .col { padding: var(--s5); border-radius: var(--r-md); background: rgba(255,255,255,.025); border: 1px solid var(--border); }
.split .col h3 { font-size: .95rem; }
.split .col.yes h3 i { color: #34D399; }
.split .col.no h3 i { color: #F87171; }
.split .col ul li { font-size: .95rem; }

/* parental rights grid */
.rights { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
.rights div { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.2); color: #fff; font-size: .95rem; }
.rights i { color: #FBBF24; }

/* service rows */
.service { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: start; }
.service > i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(52,211,153,.12); color: #34D399; font-size: .9rem; }
.service dl { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
.service dl div { font-size: .8rem; padding: 3px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--muted); }
.service dt, .service dd { display: inline; }
.service dt { color: var(--faint); }
.service dt::after { content: ': '; }
.service dd { color: #fff; }

/* app-by-app privacy cards */
.app-privacy { display: grid; gap: var(--s3); margin-top: var(--s5); }
.app-privacy article { padding: var(--s5); border-radius: var(--r-md); background: rgba(255,255,255,.025); border: 1px solid var(--border); }
.app-privacy header { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.app-privacy header img { width: 44px; height: 44px; border-radius: 22%; flex: none; }
.app-privacy header h3 { margin: 0; font-size: 1rem; }
.app-privacy header small { display: block; color: var(--faint); font-size: .75rem; word-break: break-all; }
.app-privacy .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s3); }
.app-privacy .pills span { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--muted); }
.app-privacy .pills span.good { color: #6EE7B7; background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.25); }
.app-privacy ul li { font-size: .95rem; }
.perm-table { width: 100%; border-collapse: collapse; margin-top: var(--s4); font-size: .95rem; }
.perm-table th, .perm-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.perm-table th { font-family: var(--font-display); color: #fff; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.03); }
.perm-table td:first-child { color: #fff; font-weight: 600; white-space: nowrap; }
.perm-table td:first-child i { color: var(--cyan); width: 18px; margin-right: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); margin-top: var(--s4); }
.table-wrap .perm-table { margin-top: 0; }
.table-wrap .perm-table tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .perm-table td:first-child { white-space: normal; }
  .perm-table th, .perm-table td { padding: 10px; }
}
@media print {
  .app-privacy article, .table-wrap { border: 1px solid #ccc !important; background: #fff !important; }
  .perm-table th, .perm-table td, .perm-table td:first-child { color: #111 !important; background: #fff !important; }
  .app-privacy header img { display: none; }
}

/* contact panel */
.legal-contact {
  margin-top: var(--s7); padding: clamp(28px, 5vw, 48px); border-radius: var(--r-xl); text-align: center;
  background: linear-gradient(130deg, #1b1446 0%, #0f1f4a 50%, #08303d 100%); border: 1px solid var(--border-strong);
  position: relative; overflow: hidden;
}
.legal-contact::before { content: ''; position: absolute; width: 360px; height: 360px; right: -100px; top: -160px; border-radius: 50%; background: var(--grad); filter: blur(90px); opacity: .4; }
.legal-contact > * { position: relative; }
.legal-contact h2 { justify-content: center; }
.legal-contact .contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-top: var(--s5); text-align: left; }
.legal-contact .contact-cards a { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: rgba(255,255,255,.06); border: 1px solid var(--border); color: #fff; text-decoration: none; transition: background-color .2s, transform .2s var(--ease); }
.legal-contact .contact-cards a:hover { background: rgba(255,255,255,.1); transform: translateY(-2px); }
.legal-contact .contact-cards i { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--grad); }
.legal-contact .contact-cards small { display: block; color: var(--muted); font-size: .75rem; }
.legal-contact .contact-cards span { font-size: .9rem; word-break: break-word; }
.legal-contact .updated { margin-top: var(--s5); font-size: .875rem; color: var(--muted); }

/* related document */
.related { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s5); padding: var(--s5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-decoration: none !important; color: var(--text) !important; transition: border-color .2s, background-color .2s; }
.related:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.related small { display: block; color: var(--faint); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.related b { font-family: var(--font-display); color: #fff; font-size: 1.1rem; }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; color: #fff; background: rgba(17,23,36,.85); border: 1px solid var(--border-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .25s, transform .25s var(--ease), visibility .25s, background-color .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--blue); }

.legal-main + .site-footer { margin-top: var(--s9); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .glance { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .legal-layout { grid-template-columns: 1fr; gap: var(--s5); }
  .toc { position: static; max-height: none; overflow: visible; padding: var(--s4) var(--s5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
  .toc summary { cursor: pointer; margin-bottom: 0; color: var(--muted); font-size: .8rem; }
  .toc summary .chev { display: inline-block; transition: transform .2s; }
  .toc[open] summary { margin-bottom: var(--s3); }
  .toc[open] summary .chev { transform: rotate(180deg); }
  .toc .toc-progress { display: none; }
  .legal-body { max-width: none; }
}
@media (max-width: 640px) {
  .glance { grid-template-columns: 1fr; }
  .split, .rights, .legal-contact .contact-cards { grid-template-columns: 1fr; }
  .legal-body h2 { font-size: 1.3rem; }
  .legal-body h2 .h-ico { width: 34px; height: 34px; }
  .legal-body h2 .anchor-link { display: none; }
  .hero-tools .btn { flex: 1 1 auto; }
}

/* ---------- print / save as PDF ---------- */
@media print {
  @page { margin: 18mm; }
  body { background: #fff !important; color: #111 !important; font-size: 11pt; }
  .ambient, .site-header, .toc, .hero-tools, .glance, .to-top, .read-progress, .site-footer, .crumbs, .anchor-link, .related { display: none !important; }
  .legal-hero { padding: 0 0 12pt; }
  .legal-layout { display: block; }
  h1, h2, h3, .legal-body strong { color: #000 !important; }
  .legal-hero .lead, .meta-chips span, .legal-body { color: #222 !important; }
  .meta-chips > span { border: 0; padding: 0; background: none; }
  .legal-body > section { break-inside: auto; padding: 12pt 0; border-color: #ddd; }
  .legal-body h2 { break-after: avoid; }
  .legal-body h2 .h-ico { display: none; }
  .callout, .split .col, .rights div, .legal-contact { background: #fff !important; border: 1px solid #ccc !important; color: #111 !important; break-inside: avoid; }
  .callout::before, .legal-contact::before { display: none; }
  .legal-contact, .legal-contact h2, .legal-contact .contact-cards a, .legal-contact .contact-cards small { color: #111 !important; text-align: left; }
  .legal-contact .contact-cards a { background: none; border: 0; padding: 0; }
  .legal-contact .contact-cards i { display: none; }
  .legal-body a { color: #000 !important; }
}
