/* ─── Password-locked sections · client-side AES-GCM ─── */
/* Each .lockbox renders as a "Protected section" card. The password lives in a
   single floating bar (assets/lock.js) pinned to the bottom of the page, shown
   as long as anything is still locked. Correct passphrase decrypts every block. */

.lockbox { margin-top: 30px; }

/* ── Locked placeholder card ── */
.lockbox.locked {
  border: 1px solid var(--n-rule);
  border-radius: 16px;
  overflow: hidden;
  text-align: center;
  padding: 30px 28px 26px;
  background-color: var(--n-band);
  /* soft center glow over a faint vault grid */
  background-image:
    radial-gradient(ellipse 58% 58% at 50% 40%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 72%),
    linear-gradient(rgba(17, 17, 16, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 16, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 26px 26px, 26px 26px;
  background-position: center;
}
.lockbox .lk-visual { line-height: 0; }
.lockbox .lk-visual img {
  display: block; margin: 0 auto; width: auto; max-width: 100%; max-height: 300px; height: auto;
  filter: drop-shadow(0 14px 26px rgba(17, 17, 16, 0.13));
}
.lockbox .lk-visual svg { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; }
.lockbox .lk-msg { margin: 10px auto 0; max-width: 48ch; }
.lockbox .lk-text { margin: 0; font-size: 14px; color: var(--n-ink2); line-height: 1.55; }
.lockbox .lk-text b { color: var(--n-ink); font-weight: 600; }

/* revealed content fades in */
.lockbox.unlocked { border: none; background: none; padding: 0; overflow: visible; }
.lockbox.unlocked > * { animation: lkReveal .45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes lkReveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Inline redacted figure (a hidden number inside flowing text) ── */
.lock-inline.locked {
  display: inline-block; vertical-align: baseline; white-space: nowrap; user-select: none;
  font-family: var(--n-mono); font-size: 0.82em; letter-spacing: .04em;
  color: var(--n-accent);
  background: color-mix(in oklab, var(--n-accent) 8%, #fff);
  border: 1px solid color-mix(in oklab, var(--n-accent) 26%, var(--n-rule));
  border-radius: 6px; padding: 0 6px; cursor: help;
}
.lock-inline.unlocked { animation: lkInline .5s ease both; border-radius: 3px; }
@keyframes lkInline {
  from { background: color-mix(in oklab, var(--n-accent) 22%, #fff); }
  to { background: transparent; }
}

/* ── Floating password bar ── */
.lock-float {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 80;
  display: flex; align-items: center; gap: 12px;
  background: var(--n-ink); color: var(--n-bg);
  border-radius: 999px; padding: 8px 8px 8px 18px;
  box-shadow: 0 12px 34px rgba(17, 17, 16, 0.24);
  max-width: calc(100vw - 28px);
  animation: lockFloatIn .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lock-float.out { animation: lockFloatOut .32s ease forwards; }
.lock-float .lf-lock { font-size: 14px; opacity: .85; flex: none; }
.lock-float .lf-label {
  font-family: var(--n-mono); font-size: 11px; letter-spacing: .03em;
  color: rgba(255, 255, 255, .62); white-space: nowrap; flex: none;
}
.lock-float form { display: flex; align-items: center; gap: 8px; }
.lock-float input {
  font-family: var(--n-mono); font-size: 13px; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px; padding: 9px 15px; width: 190px; min-width: 0;
  transition: border-color .18s, background .18s;
}
.lock-float input::placeholder { color: rgba(255, 255, 255, .5); }
.lock-float input:focus { outline: none; border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .18); }
.lock-float button {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--n-accent); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .18s;
}
.lock-float button:hover { transform: scale(1.07); }
.lock-float button:disabled { opacity: .5; cursor: default; transform: none; }
.lock-float.err { animation: lockShake .34s ease; }
.lock-float.err input { border-color: var(--n-accent); background: rgba(224, 51, 28, .18); }

@keyframes lockFloatIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes lockFloatOut { to { opacity: 0; transform: translate(-50%, 16px); } }
@keyframes lockShake { 10%, 90% { transform: translate(-50%, 0) translateX(-2px); } 30%, 70% { transform: translate(-50%, 0) translateX(4px); } 50% { transform: translate(-50%, 0) translateX(-4px); } }

@media (max-width: 560px) {
  .lock-float .lf-label { display: none; }
  .lock-float input { width: 100%; }
  .lock-float { left: 14px; right: 14px; transform: none; max-width: none; flex-wrap: wrap; padding: 10px 14px; border-radius: 20px; }
  .lock-float form { width: 100%; }
  .lock-float input { flex: 1; }
  @keyframes lockFloatIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes lockFloatOut { to { opacity: 0; transform: translateY(16px); } }
  @keyframes lockShake { 10%, 90% { transform: translateX(-2px); } 30%, 70% { transform: translateX(4px); } 50% { transform: translateX(-4px); } }
}

@media (prefers-reduced-motion: reduce) {
  .lockbox.unlocked > *, .lock-float { animation-duration: 0.01ms; }
}

/* ─── Whole-page gate (Storefox, Unification at Clari) ─── */
/* Same "real encryption" model as .lockbox, but for an entire case study: the
   page's content + inline scripts ship only as ciphertext (see tools/encrypt-page.mjs
   and assets/page-lock.js). Until unlocked, this gate is the only thing on the page. */
.pglock {
  position: relative; overflow: hidden;
  min-height: calc(100vh - 65px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 60px 24px;
  background-color: var(--n-band);
  background-image:
    radial-gradient(ellipse 46% 42% at 50% 38%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 72%),
    linear-gradient(rgba(17, 17, 16, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 16, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  background-position: center;
}
/* saber-beam canvas sits above the grid, below the content */
.pglock .pg-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.pglock .pg-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.pglock.shake { animation: pgShake .34s ease; }
.pglock .pg-img {
  display: block; width: auto; max-width: min(88vw, 460px); max-height: 300px; height: auto;
  filter: drop-shadow(0 18px 30px rgba(17, 17, 16, 0.14));
}
.pglock .pg-title {
  margin: 26px 0 0; font-size: clamp(22px, 3vw, 30px); font-weight: 800;
  letter-spacing: -0.02em; color: var(--n-ink); max-width: 20ch;
}
.pglock .pg-sub { margin: 10px 0 0; font-size: 15px; color: var(--n-ink3); max-width: 42ch; line-height: 1.55; }
.pglock .pg-form { display: flex; align-items: center; gap: 10px; margin: 26px 0 0; }
.pglock .pg-form input {
  font-family: var(--n-mono); font-size: 14px; color: var(--n-ink);
  background: #fff; border: 1px solid var(--n-rule); border-radius: 999px;
  padding: 12px 18px; width: 220px; max-width: 56vw;
  transition: border-color .18s, box-shadow .18s;
}
.pglock .pg-form input:focus { outline: none; border-color: var(--n-accent); box-shadow: 0 0 0 3px rgba(224, 51, 28, 0.12); }
.pglock .pg-form button {
  font-family: var(--n-mono); font-size: 12px; letter-spacing: .04em;
  padding: 12px 22px; border-radius: 999px; border: 1px solid var(--n-ink);
  background: var(--n-ink); color: var(--n-bg); cursor: pointer;
  transition: background .18s, border-color .18s;
}
.pglock .pg-form button:hover { background: var(--n-accent); border-color: var(--n-accent); }
.pglock .pg-form button:disabled { opacity: .5; cursor: default; }
.pglock .pg-err {
  font-family: var(--n-mono); font-size: 11.5px; color: var(--n-accent);
  margin-top: 14px; min-height: 14px; opacity: 0; transition: opacity .18s;
}
.pglock .pg-err.show { opacity: 1; }
.pglock .pg-nudge {
  margin: 22px 0 0; font-size: 13px; color: var(--n-ink3); line-height: 1.55; max-width: 40ch;
}
.pglock .pg-nudge a { color: var(--n-accent); }
.pglock .pg-nudge a:hover { text-decoration: underline; }

@keyframes pgShake { 10%, 90% { transform: translateX(-3px); } 30%, 70% { transform: translateX(6px); } 50% { transform: translateX(-6px); } }

@media (max-width: 560px) {
  .pglock .pg-form { flex-direction: column; width: 100%; max-width: 320px; }
  .pglock .pg-form input,
  .pglock .pg-form button { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pglock.shake { animation-duration: 0.01ms; }
}
