/* Stax Planner — the zero-knowledge chapter (includes/zero-knowledge.php)
   of the home page. Loaded after the
   design's own stylesheet, which sets the colours and fonts. Its motion is
   assets/js/zero-knowledge.js. */

/* ---------- Promise ---------- */
.p-promise { padding: 130px 0; border-top: 1px solid var(--rule); background: linear-gradient(180deg, var(--paper), var(--paper-lo)); }
.p-letter { display: grid; justify-items: center; gap: 22px; margin: 0 0 90px; }
.p-letter-toggle { display: inline-flex; border: 1px solid var(--ink); border-radius: 2px; }
.p-letter-toggle button { font: inherit; font-size: 14px; letter-spacing: 0.04em; border: 0; padding: 12px 22px; background: transparent; color: var(--ink); cursor: pointer; transition: background 0.3s, color 0.3s; }
.p-letter-toggle button.is-on { background: var(--ink); color: var(--paper-hi); }
.p-letter-card {
  position: relative; width: min(720px, 100%); padding: 56px 60px 52px;
  background: var(--paper-hi);
  box-shadow: 0 1px 0 var(--rule), 0 40px 70px -40px rgba(60, 40, 10, 0.4);
  transform: rotate(-0.6deg);
}
.p-letter-line { font-family: var(--hand); font-size: clamp(30px, 3.6vw, 44px); line-height: 1.15; color: var(--ink-2); overflow-wrap: anywhere; }
.p-letter-small { margin-top: 12px; font-family: var(--hand); font-size: 26px; color: var(--muted); overflow-wrap: anywhere; }
.p-letter.is-sealed .p-letter-line, .p-letter.is-sealed .p-letter-small { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 17px; letter-spacing: 0.04em; color: var(--emerald); }
.p-wax {
  position: absolute; right: -22px; top: -22px; width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 30px; color: rgba(255, 240, 200, 0.85);
  background: radial-gradient(circle at 35% 30%, #3b8a68, #1f5a43 55%, #133d2c);
  box-shadow: 0 10px 18px -6px rgba(19, 61, 44, 0.6), inset 0 -4px 8px rgba(0, 0, 0, 0.25), inset 0 3px 6px rgba(255, 255, 255, 0.18);
  transform: scale(0.85); opacity: 0; transition: transform 0.6s var(--ease), opacity 0.4s;
}
.p-letter.is-sealed .p-wax { transform: scale(1) rotate(-8deg); opacity: 1; }
.p-principles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 50px; }
.p-principles span { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); }
.p-principles h3 { font-family: var(--serif); font-size: 25px; margin: 10px 0 10px; letter-spacing: -0.01em; }
.p-principles p { color: var(--muted); font-size: 16px; }
@media (max-width: 860px) { .p-principles { grid-template-columns: 1fr; gap: 34px; } .p-letter-card { padding: 40px 28px; } .p-wax { right: -8px; } }

/* ---------- The parts after the letter ---------- */
.p-promise { --zk-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.zk-part { margin-top: 110px; padding-top: 44px; border-top: 3px double var(--ink); }
.zk-part-head { margin-bottom: 44px; }
.zk-title { font-family: var(--serif); font-size: clamp(30px, 3.6vw, 46px); line-height: 1.08; letter-spacing: -0.02em; margin-top: 16px; }
.zk-title i { color: var(--emerald); }

/* ---------- Text motion (zero-knowledge.js) ----------
   Nothing is hidden unless the script is running and the visitor has not
   asked for reduced motion (the script then sets .zk-motion on <html>). */
/* A heading resolves out of cipher text: each letter keeps its own width
   and shows a small cipher character on top until it is solved. */
.zk-motion [data-decipher]:not([data-seen]) { visibility: hidden; }
.zk-word { display: inline-block; white-space: nowrap; }
.zk-letter { position: relative; display: inline-block; }
.zk-letter.is-cipher { color: transparent; -webkit-text-fill-color: transparent; }
.zk-letter.is-cipher::before {
  content: attr(data-g); position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 0.5em/1 var(--zk-mono); font-style: normal; letter-spacing: 0;
  color: var(--emerald); -webkit-text-fill-color: var(--emerald);
}
/* A list writes itself in, one line after the other. */
.zk-motion [data-zk-print] > * { opacity: 0; transform: translateY(10px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: calc(var(--i, 0) * 220ms); }
.zk-motion [data-zk-print][data-seen] > * { opacity: 1; transform: none; }
[data-zk-print] > :nth-child(2) { --i: 1; }
[data-zk-print] > :nth-child(3) { --i: 2; }
[data-zk-print] > :nth-child(4) { --i: 3; }
[data-zk-print] > :nth-child(5) { --i: 4; }
[data-zk-print] > :nth-child(6) { --i: 5; }
[data-zk-print] > :nth-child(7) { --i: 6; }

/* ---------- One note, in four steps ---------- */
.zk-path { background: var(--paper-hi); border: 1px solid var(--ink); box-shadow: 0 40px 70px -46px rgba(60, 40, 10, 0.45); }
.zk-tabs { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--ink); }
.zk-tabs button {
  display: flex; align-items: baseline; gap: 10px; padding: 18px 22px; border: 0; border-left: 1px solid var(--rule); background: transparent;
  font-family: var(--serif); font-size: 19px; color: var(--muted); text-align: left; cursor: pointer; transition: color 0.3s, background 0.3s;
}
.zk-tabs button:first-child { border-left: 0; }
.zk-tabs button span { font-style: italic; font-size: 15px; color: var(--gold); }
.zk-tabs button:hover, .zk-tabs button.is-on { color: var(--ink); }
.zk-tabs button.is-on { background: rgba(31, 90, 67, 0.06); }
.zk-tab-mark { position: absolute; left: 0; bottom: -1px; width: 25%; height: 3px; background: var(--emerald); transition: transform 0.5s var(--ease); }
.zk-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.zk-visual { padding: clamp(24px, 3.4vw, 44px); }

/* Three places and the wire between them. The wire is a line of cipher
   text; the courier is the note, ink while readable, wax once sealed. */
.zk-route { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; gap: 10px; padding-top: 38px; }
.zk-place { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); text-align: center; transition: color 0.4s; }
.zk-place:nth-child(3) { text-align: left; }
.zk-place:nth-child(5) { text-align: right; }
.zk-place small { display: block; margin-top: 4px; font-family: var(--serif); font-style: italic; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--gold); }
.zk-route[data-at="0"] .zk-place:nth-child(3), .zk-route[data-at="1"] .zk-place:nth-child(4), .zk-route[data-at="2"] .zk-place:nth-child(5) { color: var(--ink); }
.zk-wire { position: absolute; left: 0; right: 0; top: 6px; height: 14px; overflow: hidden; white-space: nowrap; font: 500 10px/14px var(--zk-mono); letter-spacing: 0.1em; color: var(--emerald); opacity: 0.32; transition: opacity 0.5s; }
.zk-path.is-sealed .zk-wire { opacity: 0.8; }
.zk-courier {
  position: absolute; top: 0; left: 0; width: 26px; height: 26px; margin-left: -1px; border-radius: 3px;
  background: var(--paper-hi); border: 1.5px solid var(--ink); box-shadow: 0 6px 12px -6px rgba(60, 40, 10, 0.6);
  transition: left 1.4s var(--ease), margin-left 1.4s var(--ease), border-radius 0.6s, background 0.6s, border-color 0.6s;
}
.zk-courier::after { content: ""; position: absolute; inset: 6px 5px; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); opacity: 0.6; transition: opacity 0.4s; }
.zk-route[data-at="1"] .zk-courier { left: 50%; margin-left: -13px; }
.zk-route[data-at="2"] .zk-courier { left: 100%; margin-left: -25px; }
.zk-path.is-sealed .zk-courier { border-radius: 50%; border-color: transparent; background: var(--zk-wax, radial-gradient(circle at 35% 30%, #3b8a68, #1f5a43 55%, #133d2c)); }
.zk-path.is-sealed .zk-courier::after { opacity: 0; }

/* The note itself: handwriting while readable, cipher text once sealed. */
.zk-note { position: relative; margin-top: 34px; padding: 26px 28px 24px; background: var(--paper); box-shadow: 0 1px 0 var(--rule), inset 0 0 0 1px var(--rule); }
.zk-note-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 0 34px 12px 0; border-bottom: 1px dashed var(--rule); font: 500 11.5px/1.4 var(--zk-mono); letter-spacing: 0.06em; color: var(--muted); }
.zk-note-head b { font-weight: 500; color: var(--emerald); }
.zk-record { margin-top: 16px; min-height: 2.5em; font-family: var(--hand); font-size: clamp(26px, 2.9vw, 36px); line-height: 1.2; color: var(--ink-2); overflow-wrap: anywhere; }
.zk-record[data-to="sealed"], .zk-record[data-to="plain"] .zk-rest { font-family: var(--zk-mono); font-size: 0.5em; letter-spacing: 0.05em; color: var(--emerald); }
.zk-record[data-to="sealed"] { font-size: clamp(13px, 1.45vw, 18px); line-height: 2.4; }
.zk-record[data-to="sealed"] .zk-rest { font-family: var(--hand); font-size: 2em; letter-spacing: 0; color: var(--ink-2); line-height: 1; }
.zk-wax { right: -20px; top: -24px; width: 58px; height: 58px; font-size: 24px; }
.zk-path.is-sealed .zk-wax { transform: scale(1) rotate(-8deg); opacity: 1; }
.zk-log { margin: 14px 0 0; min-height: 6.6em; font: 500 12.5px/1.65 var(--zk-mono); color: var(--muted); white-space: pre-wrap; }

/* The steps in words. With the script running only the chosen one shows. */
.zk-steps { list-style: none; margin: 0; padding: clamp(24px, 3.4vw, 44px); border-left: 1px dashed var(--rule); display: grid; gap: 34px; align-content: center; }
.js .zk-steps { display: grid; }
.js .zk-step { display: none; }
.js .zk-step.is-on { display: block; animation: zk-step-in 0.6s var(--ease); }
@keyframes zk-step-in { from { opacity: 0; transform: translateY(10px); } }
.zk-step h4 { margin: 14px 0 12px; font-family: var(--serif); font-weight: 400; font-size: clamp(23px, 2.4vw, 31px); line-height: 1.15; letter-spacing: -0.01em; }
.zk-step > p:last-child { color: var(--muted); }

/* ---------- The chain of keys ---------- */
.zk-chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 34px; }
.zk-chain li { position: relative; padding-top: 22px; border-top: 1px solid var(--ink); }
/* Each key hangs from the one before it. */
.zk-chain li + li::before { content: ""; position: absolute; left: -34px; top: -1px; width: 34px; border-top: 1px dashed var(--gold); }
.zk-key { color: var(--emerald); }
.zk-chain h4 { margin: 12px 0 8px; font-family: var(--serif); font-weight: 400; font-size: 23px; letter-spacing: -0.01em; }
.zk-chain p { color: var(--muted); font-size: 15.5px; }
.zk-chain small { display: inline-block; margin-top: 12px; font: 500 11px/1.4 var(--zk-mono); letter-spacing: 0.08em; color: var(--gold); }
.zk-chain-hand { margin-top: 36px; transform: rotate(-1.5deg); }

/* ---------- What stays, and what we keep ---------- */
.zk-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }
.zk-ledger h4 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.zk-list { list-style: none; margin: 0; padding: 0; }
.zk-list li { position: relative; padding: 13px 0 13px 30px; border-bottom: 1px solid var(--rule); }
.zk-list li::before { position: absolute; left: 2px; top: 13px; font-family: var(--zk-mono); font-size: 14px; }
.zk-list-never li { font-family: var(--hand); font-size: 24px; line-height: 1.2; color: var(--ink-2); }
.zk-list-never li::before { content: "✕"; top: 15px; color: var(--gold); }
.zk-list-kept li { font: 500 13.5px/1.6 var(--zk-mono); color: var(--muted); }
.zk-list-kept li::before { content: "▪"; color: var(--emerald); }
.zk-ledger-more { margin-top: 18px; font-size: 15px; }
.zk-ledger-more a { color: var(--emerald); }

@media (max-width: 900px) {
  .zk-part { margin-top: 80px; }
  .zk-panel, .zk-ledger { grid-template-columns: 1fr; }
  .zk-ledger { gap: 44px; }
  .zk-steps { border-left: 0; border-top: 1px dashed var(--rule); }
  .zk-chain { grid-template-columns: 1fr 1fr; gap: 34px; }
  .zk-chain li + li::before { display: none; }
}
@media (max-width: 560px) {
  .zk-tabs button { flex-direction: column; gap: 2px; padding: 12px 12px; font-size: 16px; }
  .zk-chain { grid-template-columns: 1fr; }
  .zk-place { font-size: 9.5px; letter-spacing: 0.1em; }
  .zk-note { padding: 22px 18px 20px; }
  .zk-wax { right: -8px; }
}
