/* The soft gate on the Streak Society and News Feed case studies (see
   case-gate.js). A curation gate, not security. */

/* ---- On a homepage card: the link carries a padlock and opens a password line ----
   While locked, a gated card's "dive deeper" link is hidden and a form with
   the same box and position (it carries .v2-card-link too) takes its place:
   "dive deeper" with a padlock. Clicking it swaps the words for "password:"
   and a line to type on (.is-asking). Unlocked, the plain link is back. */
html:not(.dive-unlocked) a.v2-card-link[data-gated],
html.dive-unlocked form.v2-card-link.is-gate { display: none; }
form.v2-card-link.is-gate { display: inline-flex; align-items: center; gap: 0; margin: 0; cursor: pointer; }
.is-gate .gate-label {
  font: inherit; color: inherit; line-height: 1; background: none; border: 0; padding: 0; margin-right: 6px;
  white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity 0.14s ease;
}
.is-gate .gate-label.is-swapping { opacity: 0; }
.is-gate .gate-label:focus { outline: none; }
.is-gate .gate-label:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; border-radius: 2px; }
/* The typing line is always there but folded away (no width, invisible);
   asking grows it out to the left of the padlock while the words swap, so
   the change reads as one smooth opening instead of a snap. */
.is-gate .gate-line {
  display: block; box-sizing: content-box; width: 0; min-width: 0; margin-right: 0; padding: 3px 0 2px;
  font: inherit; font-size: 13px; color: inherit; line-height: 1.2;
  background: transparent; border: 0; border-bottom: 1px solid currentColor; border-radius: 0; outline: none;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: width 0.5s cubic-bezier(0.33, 0, 0.15, 1), margin-right 0.5s cubic-bezier(0.33, 0, 0.15, 1),
              opacity 0.3s ease, visibility 0s linear 0.5s;
}
.is-gate.is-asking { cursor: text; opacity: 1; }
.is-gate.is-asking .gate-label { cursor: default; }
.is-gate.is-asking .gate-line {
  width: 108px; margin-right: 8px; opacity: 0.9; visibility: visible; pointer-events: auto;
  transition: width 0.5s cubic-bezier(0.33, 0, 0.15, 1), margin-right 0.5s cubic-bezier(0.33, 0, 0.15, 1),
              opacity 0.4s ease 0.15s, visibility 0s;
}
.is-gate.is-asking .gate-line:focus { opacity: 1; }
.is-gate .gate-line.is-wrong { animation: gate-shake 0.35s ease; }
/* Cancel: a small cross that only shows while the password line is open. */
.is-gate .gate-cancel {
  display: none; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 24px; height: 24px; margin: -4px -6px -4px -5px; padding: 0;
  background: none; border: 0; color: inherit; opacity: 0.6; cursor: pointer; border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.is-gate .gate-cancel:hover, .is-gate .gate-cancel:focus-visible { opacity: 1; }
.is-gate .gate-cancel:focus { outline: none; }
.is-gate .gate-cancel:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; }
.is-gate.is-asking .gate-cancel { display: inline-flex; }
.is-gate.is-checked .gate-cancel, .is-gate.is-granted .gate-cancel { display: none; }
/* The icon slot: padlock, then (when the right password is typed) a checkmark
   that draws itself, then the diving mask. */
.gate-icon { position: relative; display: inline-grid; flex: 0 0 auto; width: 16px; height: 16px; }
.gate-icon svg { grid-area: 1 / 1; width: 16px; height: 16px; transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.33, 0, 0.15, 1); }
.gate-icon .i-check, .gate-icon .i-mask { opacity: 0; transform: scale(0.55); }
.gate-icon .i-check path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.is-gate.is-checked .gate-icon .i-lock { opacity: 0; transform: scale(0.55) rotate(-14deg); }
.is-gate.is-checked .gate-icon .i-check { opacity: 1; transform: none; }
.is-gate.is-checked .gate-icon .i-check path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.55s cubic-bezier(0.65, 0, 0.35, 1) 0.2s; }
.is-gate.is-granted .gate-icon .i-check { opacity: 0; transform: scale(0.55); }
.is-gate.is-granted .gate-icon .i-mask { opacity: 1; transform: none; }
.is-gate.is-checked { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .gate-icon svg, .is-gate .gate-label { transition-duration: 0.01s; } }
@keyframes gate-shake {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ---- On a gated page: the prompt in place of the page content ---- */
html.case-gated header.cs-hero2,
html.case-gated main,
html.case-gated nav.cs-end { display: none !important; }
.case-gate-screen { display: flex; justify-content: center; padding: 140px 24px 160px; }
.case-gate { width: 100%; max-width: 420px; color: var(--black, #111110); }
.case-gate .gate-text { margin: 0 0 22px; font-size: 20px; font-weight: 600; line-height: 1.45; letter-spacing: -0.015em; }
.case-gate .gate-row { display: flex; align-items: flex-end; gap: 14px; }
.case-gate .gate-input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 17px; color: inherit;
  background: transparent; border: 0; border-bottom: 1px solid #b9b9b4; border-radius: 0; padding: 8px 2px; outline: none;
}
.case-gate .gate-input:focus { border-bottom-color: var(--black, #111110); }
.case-gate .gate-btn {
  flex: 0 0 auto; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--black, #111110); border: 0; border-radius: 999px; padding: 10px 24px;
}
.case-gate .gate-btn:hover { opacity: 0.85; }
.case-gate .gate-msg { margin: 10px 0 0; min-height: 20px; font-size: 15px; color: #6b6b66; }

/* ---- Footer lock: once someone has unlocked, show it so they can relock ---- */
.dive-unlocked .dive-lock[hidden] { display: inline-flex; }

.case-gate .gate-input.is-wrong { animation: gate-shake 0.35s ease; }
