/* ------------------------------------------------------------------
   Case studies: card → detail page transition, the detail pages,
   and the password pop-up for NDA projects.
   Loaded on index.html, work.html and every case-*.html page.
------------------------------------------------------------------- */

/* page → page: the clicked card's picture grows into the detail page's hero
   (cross-document View Transitions; browsers without it simply navigate) */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-group(cs-hero) { animation-duration: .55s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* ---- detail page ---- */
.cs {
  width: min(100% - 48px, 1100px);
  margin: 0 auto;
  padding: 180px 0 160px;
}
.cs-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 14px; letter-spacing: -0.02em; text-transform: uppercase;
  color: var(--grey); transition: color .2s;
}
.cs-back img { width: 20px; height: 20px; opacity: .6; transition: opacity .2s, transform .2s; }
.cs-back:hover, .cs-back:focus-visible { color: var(--black); }
.cs-back:hover img, .cs-back:focus-visible img { opacity: 1; transform: translateX(-3px); }

.cs-head { margin-top: 40px; display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.cs-kicker { font-family: var(--mono); font-size: 14px; letter-spacing: -0.02em; text-transform: uppercase; color: var(--grey); }
.cs-title { display: flex; align-items: flex-start; gap: .22em; font-size: 48px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; }
.cs-title .lock { flex: none; width: .72em; height: .72em; margin-top: .2em; }   /* the card lock (styles.css), scaled to the title; its img fills it the same way */
.cs-desc { font-size: 20px; line-height: 1.45; letter-spacing: -0.01em; color: var(--grey); }

.cs-hero {
  position: relative; margin: 48px 0 0; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 12px; background: #f2f2f2;
  view-transition-name: cs-hero;
}
.cs-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-hero__logo { position: absolute; left: 50%; top: 50%; width: 28%; height: auto; transform: translate(-50%, -50%); }

.cs-soon { margin-top: 64px; padding-top: 32px; border-top: 1px dashed #d4d4d4; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.cs-soon__tag { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 14px; letter-spacing: -0.02em; text-transform: uppercase; color: var(--grey); }
.cs-soon__text { font-size: 18px; line-height: 1.5; letter-spacing: -0.01em; }
.cs-soon__text a { text-decoration: underline; text-underline-offset: 3px; }

/* an NDA page stays empty until the password has been given */
.cs[data-locked]:not(.is-unlocked) .cs-content { visibility: hidden; }

@media (max-width: 760px) {
  .cs { padding: 120px 0 96px; }
  .cs-head { margin-top: 28px; gap: 12px; }
  .cs-kicker, .cs-back, .cs-soon__tag { font-size: 12px; }
  .cs-title { font-size: 30px; }
  .cs-desc { font-size: 16px; }
  .cs-hero { margin-top: 32px; border-radius: 8px; aspect-ratio: 4 / 3; }
  .cs-soon { margin-top: 44px; padding-top: 24px; }
  .cs-soon__text { font-size: 16px; }
}

/* ---- password pop-up ---- */
.pw {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
  background: rgba(20, 20, 20, .45);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .25s ease;
}
.pw.is-open { opacity: 1; }
.pw[hidden] { display: none; }
.pw__box {
  width: min(100%, 420px);
  padding: 28px 28px 24px; border-radius: 16px;
  background: #fff; color: var(--black);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  transform: translateY(12px) scale(.98); transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.pw.is-open .pw__box { transform: none; }
.pw__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #f1f1f1; }
.pw__icon { position: relative; color: var(--black); }
.pw__icon svg { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; translate: -50% -50%; transition: opacity .2s, transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.pw__hole { fill: #f1f1f1; }                       /* the keyhole shows the bubble behind it */
.pw__unlock { opacity: 0; transform: scale(.85); }
.pw.is-unlocked .pw__lock { opacity: 0; transform: scale(.85); }
.pw.is-unlocked .pw__unlock { opacity: 1; transform: none; }
.pw__title { margin-top: 16px; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.pw__text { margin-top: 8px; font-size: 15px; line-height: 1.45; letter-spacing: -0.01em; color: var(--grey); }
.pw__label { display: block; margin-top: 22px; font-family: var(--mono); font-size: 13px; letter-spacing: -0.02em; text-transform: uppercase; color: #5c5c5c; }
.pw__field { position: relative; margin-top: 8px; }
.pw__input {
  width: 100%; height: 48px; padding: 0 48px 0 14px;
  border: 1.5px solid #cfcfcf; border-radius: 10px; background: #fff;
  font: inherit; font-size: 16px;   /* 16px: phones don't zoom in on focus */
  color: var(--black); transition: border-color .15s, box-shadow .15s;
}
.pw__input:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(26, 26, 26, .12); }
.pw__input[aria-invalid="true"] { border-color: #c4161c; }
.pw__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(196, 22, 28, .15); }
.pw__peek {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: #6b6b6b; cursor: pointer;
}
.pw__peek:hover { background: #f2f2f2; color: var(--black); }
.pw__peek:focus-visible { outline: 2px solid var(--black); outline-offset: 1px; }
.pw__peek svg { width: 20px; height: 20px; }
.pw__peek .i-hide, .pw__peek[aria-pressed="true"] .i-show { display: none; }
.pw__peek[aria-pressed="true"] .i-hide { display: block; }
.pw__error { display: flex; align-items: flex-start; gap: 6px; min-height: 20px; margin-top: 8px; font-size: 14px; line-height: 1.4; color: #c4161c; }
.pw__error:empty { visibility: hidden; }
.pw__error svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.pw__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.pw__btn {
  height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s, opacity .15s;
}
.pw__btn--ghost { background: none; border-color: #d6d6d6; color: var(--black); }
.pw__btn--ghost:hover { background: #f4f4f4; }
.pw__btn--main { background: var(--black); color: #fff; }
.pw__btn--main:hover { background: #333; }
.pw__btn:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.pw__btn[disabled] { opacity: .6; cursor: progress; }
.pw__help { margin-top: 18px; padding-top: 14px; border-top: 1px solid #eee; font-size: 13px; color: var(--grey); }
@media (max-width: 480px) { .pw__br { display: none; } }   /* on phones the two sentences just flow (a forced break leaves one-word lines) */
.pw__help a { color: var(--black); text-decoration: underline; text-underline-offset: 2px; }
.pw__copied { display: block; margin-top: 6px; font-size: 12px; color: var(--grey); }
.pw__copied:empty { display: none; }
.pw.is-wrong .pw__box { animation: pw-shake .4s; }
@keyframes pw-shake { 20%, 60% { translate: -6px 0; } 40%, 80% { translate: 6px 0; } }
@media (prefers-reduced-motion: reduce) {
  .pw, .pw__box { transition: none; }
  .pw.is-wrong .pw__box { animation: none; }
}
.pw-open { overflow: hidden; }
