/* ============================================================
   legal.css — /terms and /privacy
   Layers on top of styles.css (same tokens, same rhythm).
   ============================================================ */

body.legal-page { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- reading progress ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; background: transparent; }
.progress i { display: block; height: 100%; width: 0%; background: var(--signal); transition: width .08s linear; box-shadow: 0 0 8px rgba(53,240,160,.6); }

/* ---------- hero ---------- */
.lhero { padding: clamp(40px, 7vw, 76px) 0 clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.lhero__icon { width: 48px; height: 48px; margin-bottom: 22px; image-rendering: pixelated; }
.lhero .h1 { font-size: clamp(24px, 4.2vw, 40px); margin-bottom: 14px; }
.lhero__meta {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  font-family: var(--mono); font-size: 12.5px; color: var(--fg-3); margin: 0 0 28px;
}
.lhero__meta b { color: var(--fg-2); font-weight: 500; }
.lhero__meta .dot { width: 4px; height: 4px; background: var(--line-2); border-radius: 50%; }

.tldr {
  padding: 20px 22px; border-left: 3px solid var(--signal);
}
.tldr__t {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--signal); margin: 0 0 13px;
}
.tldr ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tldr li { position: relative; padding-left: 24px; color: var(--fg-2); font-size: 14.5px; line-height: 1.55; }
.tldr li::before {
  content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px;
  background: var(--signal);
  clip-path: polygon(0 40%, 20% 40%, 20% 60%, 40% 60%, 40% 80%, 80% 80%, 80% 60%, 100% 60%, 100% 20%, 80% 20%, 80% 40%, 60% 40%, 60% 60%, 40% 60%, 40% 40%, 20% 40%, 20% 20%, 0 20%);
}
.tldr__n { font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); margin: 14px 0 0; }
.tldr__n a { color: var(--wire); }

/* ---------- body: toc + article ---------- */
.lbody { padding: clamp(36px, 5vw, 60px) 0 clamp(60px, 8vw, 100px); }
.lbody__in { display: grid; grid-template-columns: 236px 1fr; gap: clamp(28px, 4vw, 56px); align-items: start; }

.toc { position: sticky; top: 84px; }
.toc__t {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--fg-3); margin: 0 0 14px;
}
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; }
.toc li { border-left: 2px solid var(--line); }
.toc a {
  display: block; padding: 8px 0 8px 14px; font-family: var(--mono); font-size: 12.5px;
  color: var(--fg-3); transition: color .15s;
}
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc li.active { border-left-color: var(--signal); }
.toc li.active a { color: var(--signal); }

.toc__mobile { display: none; }

article.ldoc section {
  padding-top: 44px; margin-top: 44px; border-top: 1px solid var(--line); scroll-margin-top: 84px;
}
article.ldoc section:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.sec__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sec__head .kicker { margin: 0; min-width: 0; }
.sec__head .h2 { margin: 0; min-width: 0; }
.sec__link {
  margin-left: auto; flex: none; background: transparent; border: 1px solid transparent;
  color: var(--fg-3); font-family: var(--mono); font-size: 11px; padding: 5px 9px; cursor: pointer;
  border-radius: 3px; transition: .15s; opacity: 0;
}
.sec__head:hover .sec__link { opacity: 1; }
.sec__link:hover { color: var(--signal); border-color: var(--line-2); }

article.ldoc p { color: var(--fg-2); font-size: 15px; line-height: 1.75; max-width: 68ch; margin: 0 0 16px; }
article.ldoc p:last-child { margin-bottom: 0; }
article.ldoc strong { color: var(--fg); font-weight: 600; }
article.ldoc a { color: var(--wire); }
article.ldoc h3 {
  font-family: var(--mono); font-weight: 700; font-size: 13.5px; letter-spacing: .04em;
  color: var(--fg); text-transform: uppercase; margin: 24px 0 12px;
}
article.ldoc ul.plain { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 9px; max-width: 68ch; }
article.ldoc ul.plain li {
  position: relative; padding-left: 22px; color: var(--fg-2); font-size: 15px; line-height: 1.65;
}
article.ldoc ul.plain li::before { content: "—"; position: absolute; left: 0; color: var(--fg-3); }
article.ldoc ol.num { list-style: none; counter-reset: ln; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; max-width: 68ch; }
article.ldoc ol.num li {
  counter-increment: ln; position: relative; padding-left: 30px; color: var(--fg-2); font-size: 15px; line-height: 1.65;
}
article.ldoc ol.num li::before {
  content: counter(ln); position: absolute; left: 0; top: -1px;
  font-family: var(--mono); font-size: 11px; color: var(--signal);
  border: 1px solid var(--line-2); width: 18px; height: 18px; display: grid; place-items: center;
}

.note {
  display: flex; gap: 13px; padding: 15px 17px; margin: 20px 0; max-width: 68ch;
  border-radius: var(--r); font-size: 14px; line-height: 1.65;
}
.note__i { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 3px; height: fit-content; }
.note p { margin: 0 !important; }
.note--warn { background: rgba(255,197,61,.07); border: 1px solid rgba(255,197,61,.35); }
.note--warn .note__i { background: var(--watt); color: #241A00; }
.note--warn p { color: #E8CE8E !important; }
.note--info { background: rgba(76,201,240,.07); border: 1px solid rgba(76,201,240,.3); }
.note--info .note__i { background: var(--wire); color: #04202B; }
.note--info p { color: #A9D6E8 !important; }
.note--bad { background: rgba(255,95,87,.07); border: 1px solid rgba(255,95,87,.32); }
.note--bad .note__i { background: #FF5F57; color: #2B0603; }
.note--bad p { color: #E8ACA9 !important; }

.miniTable { width: 100%; max-width: 68ch; border-collapse: collapse; margin: 8px 0 20px; font-size: 14px; }
.miniTable th, .miniTable td { text-align: left; padding: 10px 14px; border: 1px solid var(--line); }
.miniTable th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); background: var(--ink-2); }
.miniTable td { color: var(--fg-2); }
.miniTable code { font-family: var(--mono); font-size: 12.5px; color: var(--signal); }

/* ---------- closing panel ---------- */
.lclose {
  margin-top: 56px; padding: 26px; display: grid; gap: 20px;
  grid-template-columns: 1fr auto; align-items: center;
}
.lclose p { margin: 0; color: var(--fg-2); font-size: 14px; }
.lclose p b { color: var(--fg); }
.lclose a.btn { flex: none; }

/* ---------- back to top ---------- */
.toTop {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--slate); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--fg-2); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s, transform .2s var(--ease), border-color .15s, color .15s;
  box-shadow: 0 10px 26px -14px rgba(0,0,0,.8);
}
.toTop.show { opacity: 1; pointer-events: auto; transform: none; }
.toTop:hover { border-color: var(--signal); color: var(--signal); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .lbody__in { grid-template-columns: 1fr; }
  .toc { display: none; }
  .toc__mobile {
    display: block; position: sticky; top: 62px; z-index: 40;
    background: var(--ink); border: 1px solid var(--line); border-radius: var(--r);
    margin-bottom: 8px;
  }
  .toc__mobile summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 16px; cursor: pointer; list-style: none;
    font-family: var(--mono); font-size: 12.5px; color: var(--fg); letter-spacing: .05em;
  }
  .toc__mobile summary::-webkit-details-marker { display: none; }
  .toc__mobile summary::after { content: "+"; color: var(--fg-3); font-family: var(--px); font-size: 11px; }
  .toc__mobile[open] summary::after { content: "\2212"; }
  .toc__mobile[open] summary { border-bottom: 1px solid var(--line); }
  .toc__mobile ol { list-style: none; margin: 0; padding: 6px 0; }
  .toc__mobile a { display: block; padding: 10px 16px; font-family: var(--mono); font-size: 13px; color: var(--fg-2); }
  .toc__mobile a:hover { color: var(--signal); text-decoration: none; }
  article.ldoc section { scroll-margin-top: 118px; }
}

@media (max-width: 560px) {
  .lclose { grid-template-columns: 1fr; text-align: center; }
  .lclose a.btn { width: 100%; }
  .sec__link { margin-left: 0; opacity: 1; }
  .toTop { right: 14px; bottom: 14px; }
}

@media print {
  .nav, .authbar, .progress, .toc, .toc__mobile, .toTop, .foot, .sec__link { display: none !important; }
  body { background: #fff; color: #000; }
}
