/* TD795 design proposal: the protected-facts editing module on /ai/paper and its editions.
   Scoped to #protected-facts-editing. The ID scope outranks the page's inline <style> and
   site-ia.css (whose strongest relevant selectors are (0,3,2)), so it changes this module only.
   Tokens come from site-ia.css, which exposes them on both body.site-shell (EN) and the bare
   <body> of the localized paper pages; literal fallbacks keep the module readable without them.
   Proposal only: not integrated, not owner-approved. */
#protected-facts-editing { --pfe-measure: 960px; }
#protected-facts-editing .pfe-example { max-width: var(--pfe-measure); }
/* Reading measure: the prompt is prose, so it keeps a ~85ch line (site review: deck 640, body 560). */
#protected-facts-editing .pfe-prompt { max-width: 46rem; }

/* Prompt: a native disclosure, so it opens without JavaScript; the template stays plain,
   selectable text in the body face (it is prose to paste, not code). */
#protected-facts-editing .pfe-prompt { margin: 28px 0 0; }
#protected-facts-editing .pfe-prompt > summary {
  display: flex; align-items: center; gap: 12px; width: fit-content; min-height: 44px; padding: 0 4px;
  color: var(--cue-ink, #1d1a1a); font-size: 16px; font-weight: 600; line-height: 1.4;
  list-style: none; cursor: pointer;
}
#protected-facts-editing .pfe-prompt > summary::-webkit-details-marker { display: none; }
#protected-facts-editing .pfe-prompt > summary::before {
  content: ''; flex: none; width: 7px; height: 7px; margin: 0 2px;
  border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(-45deg); transition: transform .16s cubic-bezier(.2, .8, .2, 1);
}
#protected-facts-editing .pfe-prompt[open] > summary::before { transform: translate(1px, -2px) rotate(45deg); }
#protected-facts-editing .pfe-prompt > summary:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
#protected-facts-editing .pfe-prompt pre {
  margin: 12px 0 0; padding: 20px 22px; color: var(--cue-ink, #1d1a1a);
  background: var(--cue-surface, #f7f8fa); border: 1px solid var(--cue-line, #ecedf0); border-radius: var(--r-md, 14px);
  font-family: inherit; font-size: 15px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}

/* Example: provenance first, original and illustration side by side, then the fact check. */
#protected-facts-editing .pfe-example { margin: 32px 0 0; }
#protected-facts-editing .pfe-example > figcaption { margin: 0 0 12px; color: var(--cue-muted, #555); font-size: 14px; font-weight: 500; line-height: 1.5; }
#protected-facts-editing .pfe-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 12px; }
#protected-facts-editing .pfe-text { min-width: 0; padding: 20px 22px; background: #fff; border: 1px solid var(--cue-line, #ecedf0); border-radius: var(--r-md, 14px); }
#protected-facts-editing .pfe-label { margin: 0 0 8px; color: var(--cue-label, #6e6e6e); font-size: 12px; font-weight: 600; line-height: 1.5; letter-spacing: .08em; text-transform: uppercase; }
#protected-facts-editing :is(.pfe-body, .pfe-recover) { margin: 0; color: var(--cue-ink, #1d1a1a); font-size: 17px; line-height: 1.7; }
#protected-facts-editing mark {
  padding: 0 .12em; color: inherit; background: #eceff3; border-radius: 4px; font-weight: 600;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* The fact check is a real table: row headers name the protected fact; no extra heading levels. */
#protected-facts-editing .pfe-check { width: 100%; margin: 16px 0 0; border-collapse: separate; border-spacing: 0; color: var(--cue-ink, #1d1a1a); font-size: 15px; line-height: 1.6; }
#protected-facts-editing .pfe-check caption { caption-side: top; padding: 0 0 8px; text-align: left; font-size: 14px; font-weight: 600; }
#protected-facts-editing .pfe-check :is(th, td) { padding: 11px 14px; text-align: left; vertical-align: top; background: none; border-bottom: 1px solid var(--cue-line, #ecedf0); overflow-wrap: anywhere; }
#protected-facts-editing .pfe-check thead th { color: var(--cue-muted, #555); background: var(--cue-surface, #f7f8fa); border-bottom: 0; font-size: 13px; font-weight: 600; }
#protected-facts-editing .pfe-check thead th:first-child { border-radius: 10px 0 0 10px; }
#protected-facts-editing .pfe-check thead th:last-child { border-radius: 0 10px 10px 0; }
#protected-facts-editing .pfe-check tbody th { width: 28%; font-weight: 600; }

/* Recovery is part of the method; the closing note is the scope statement. */
#protected-facts-editing .pfe-recover { max-width: 70ch; margin: 20px 0 0; }
#protected-facts-editing .pfe-note { max-width: 70ch; margin: 12px 0 0; color: var(--cue-muted, #555); font-size: 14px; line-height: 1.6; }

/* CJK: no Latin tracking or capitals, more leading, a measure in em. */
#protected-facts-editing:is(:lang(zh), :lang(ja), :lang(ko)) :is(.pfe-body, .pfe-recover) { line-height: 1.85; }
#protected-facts-editing:is(:lang(zh), :lang(ja), :lang(ko)) .pfe-prompt pre { line-height: 1.85; }
#protected-facts-editing:is(:lang(zh), :lang(ja), :lang(ko)) .pfe-label { letter-spacing: .04em; text-transform: none; }
#protected-facts-editing:is(:lang(zh), :lang(ja), :lang(ko)) :is(.pfe-recover, .pfe-note) { max-width: 40em; }
#protected-facts-editing:lang(ko) :is(p, th, td, figcaption, caption) { word-break: keep-all; overflow-wrap: break-word; }

@media (max-width: 720px) {
  #protected-facts-editing .pfe-text { padding: 18px; }
  #protected-facts-editing .pfe-prompt pre { padding: 16px 18px; font-size: 14px; }
  #protected-facts-editing .pfe-check :is(th, td) { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { #protected-facts-editing .pfe-prompt > summary::before { transition: none; } }
