/* The account moments, "The Thread" (src/account-art.js, accountPage in src/views.js): forgot password, a new password,
   confirming an email, and "check your email". Base styles are the finished pictures; the motion plays when a pane appears
   (leaving display:none restarts its animations). Only transform, opacity and stroke-dashoffset move. Reduce Motion: stills. */

.ac-art { --ac-ink: var(--dv-indigo, #1A2360); --ac-paper: var(--dv-cotton, #F4F0E7); --ac-silk: var(--dv-silk, #CEBB9A);
  display: block; width: 132px; height: auto; margin: 0 auto 2px; overflow: visible; }
.ac-art * { transform-box: fill-box; }

/* the quiet pages: Cotton with a whisper of the weave; the card wears the Alaari tab with the D, hanging from its top edge */
.door--plain { background: var(--weave-paper), radial-gradient(70% 45% at 50% 0%, var(--card), transparent 70%), var(--paper); }
.door__card { padding-top: 40px; overflow: visible; }
.door__card .door__home { position: absolute; left: auto; right: 34px; top: -2px; width: 30px; height: 46px; margin: 0; border-radius: 0 0 3px 3px; background: none; box-shadow: 0 10px 16px -10px rgb(var(--shade) / .6); transform-origin: 50% 0; }
.door__card .door__home .dv-tab { width: 30px; height: 46px; }
.door__card .door__home .mark { display: none; }
.door__card h1 { font-size: clamp(1.8rem, 7vw, 2.15rem); }

/* each pane arrives: the picture first, then the words, then the button; a refused field gives a small sideways shake
   (app.js marks every refused field, says why and focuses the first) */
@media (prefers-reduced-motion: no-preference) {
  .door__card .auth__form > * { animation: acUp var(--dur-4, .62s) var(--ease-out, cubic-bezier(.22, .8, .24, 1)) both; }
  .door__card .auth__form > :nth-child(2) { animation-delay: 70ms; }
  .door__card .auth__form > :nth-child(3) { animation-delay: 130ms; }
  .door__card .auth__form > :nth-child(4) { animation-delay: 180ms; }
  .door__card .auth__form > :nth-child(n+5) { animation-delay: 220ms; }
  .door__card .field.is-refused, .door__fp .field.is-refused { animation: acNudge .42s var(--ease-out, ease) both; }
  .door__card .paid:not([hidden]), .door__card .notice:not([hidden]) { animation: acUp var(--dur-3, .38s) var(--ease-out, ease) both; }
}
@keyframes acUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes acNudge { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 100% { transform: none; } }

/* ---------- the envelope: sent ---------- */
.ac-sent { width: 168px; }
.ac-sent__back { fill: var(--ac-ink); }
.ac-sent__paper { fill: var(--ac-paper); }
.ac-sent__line { fill: var(--ac-silk); }
.ac-sent__pocket { fill: #222C6C; }
.ac-sent__flap { fill: #2B3778; transform-origin: 50% 0; }
.ac-sent__trail { fill: none; stroke: var(--thread, #DD3858); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; opacity: .9; }
.ac-sent__badge circle { fill: var(--ok, #1F6B4F); stroke: var(--card, #FBF9F4); stroke-width: 3; }
.ac-sent__badge path { fill: none; stroke: var(--on-ok, #F4F0E7); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; }
.ac-sent__badge { transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {
  .ac-sent__letter { animation: acLetter .7s var(--spring-k, cubic-bezier(.34, 1.36, .5, 1)) .15s both; }
  .ac-sent__flap { animation: acFlap .38s var(--ease-in-out, ease) .72s both; }
  .ac-sent__env { animation: acLift .7s var(--spring-k, ease) 1s both; transform-origin: 50% 100%; }
  .ac-sent__trail { animation: acDraw .7s var(--ease-out, ease) 1.05s both; }
  .ac-sent__badge { animation: acPop .5s var(--spring-k, ease) 1.45s both; }
  .ac-sent__badge path { animation: acDraw .35s var(--ease-out, ease) 1.7s both; }
}
@keyframes acLetter { from { transform: translateY(-34px); } }
@keyframes acFlap { from { transform: scaleY(-1); } }
@keyframes acLift { 0% { transform: none; } 40% { transform: translateY(-8px) rotate(-3deg); } 100% { transform: none; } }
@keyframes acDraw { from { stroke-dashoffset: 1; } }
@keyframes acPop { from { transform: scale(0); opacity: 0; } }

/* ---------- the key and the lock ---------- */
.ac-key, .ac-lock, .ac-done, .ac-weave, .ac-cut { width: 112px; }
.ac-key__disc { fill: var(--ac-ink); }
.ac-key__tab { fill: var(--thread, #DD3858); }
.ac-key__bow { fill: none; stroke: var(--ac-paper); stroke-width: 7; }
.ac-key__bit { fill: none; stroke: var(--ac-paper); stroke-width: 7; stroke-linecap: round; }
.ac-key__key { transform-origin: 30% 50%; }
.ac-lock__body { fill: var(--ac-paper); }
.ac-lock__shackle { fill: none; stroke: var(--ac-silk); stroke-width: 7; stroke-linecap: round; transform-origin: 85% 100%; }
.ac-lock__hole { fill: var(--ac-ink); }
.ac-lock__tick { fill: none; stroke: var(--ac-ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; }
.ac-lock--open .ac-lock__shackle { transform: translateY(-7px) rotate(28deg); }
@media (prefers-reduced-motion: no-preference) {
  .ac-key__key { animation: acTurn .9s var(--spring-k, ease) .25s both; }
  .ac-key__tab, .ac-cut .ac-key__tab { animation: acTab .7s var(--spring-k, ease) .1s both; transform-origin: 50% 0; }
  .ac-lock:not(.ac-lock--open) .ac-lock__shackle { animation: acJiggle 1s var(--ease-out, ease) .5s both; }
  .ac-lock--open .ac-lock__shackle { animation: acOpen .7s var(--spring-k, ease) .2s both; }
  .ac-lock__tick { animation: acDraw .4s var(--ease-out, ease) .6s both; }
}
@keyframes acTurn { from { transform: rotate(-80deg) scale(.6); opacity: 0; } }
@keyframes acTab { from { transform: scaleY(0); } }
@keyframes acJiggle { 30% { transform: rotate(-6deg); } 60% { transform: rotate(4deg); } 100% { transform: none; } }
@keyframes acOpen { from { transform: none; } }

/* ---------- done: ring, tick, a burst of strips ---------- */
.ac-done__disc { fill: var(--ac-ink); }
.ac-done__ring { fill: none; stroke: var(--ac-silk); stroke-width: 4; stroke-dasharray: 1 1; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ac-done__tick { fill: none; stroke: var(--ac-paper); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; }
.ac-done__strip { transform-origin: 3px 54px; transform: rotate(var(--a)) translateY(-6px); opacity: 0; }
.ac-done__burst { transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {
  .ac-done__disc { animation: acPop .55s var(--spring-k, ease) .05s both; transform-origin: 50% 50%; }
  .ac-done__ring { animation: acDraw .6s var(--ease-out, ease) .25s both; }
  .ac-done__tick { animation: acDraw .45s var(--ease-out, ease) .55s both; }
  .ac-done__strip { animation: acBurst .9s var(--ease-out, ease) calc(.7s + var(--d)) both; }
}
@keyframes acBurst { 0% { opacity: 0; transform: rotate(var(--a)) translateY(14px) scaleY(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-10px) scaleY(1); } }

/* ---------- working: the weft passes over and under ---------- */
.ac-weave__disc { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.ac-weave__warp { fill: var(--ac-ink); }
.ac-weave__warp--over { fill: #2B3778; }
.ac-weave__weft rect { fill: var(--thread, #DD3858); }
@media (prefers-reduced-motion: no-preference) {
  .ac-weave__weft { animation: acShuttle 1.1s var(--ease-in-out, ease) infinite alternate; }
}
@keyframes acShuttle { from { transform: translateX(-14px); } to { transform: translateX(14px); } }

/* ---------- expired: the strip is cut ---------- */
.ac-cut__disc { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.ac-cut__a, .ac-cut__b { fill: var(--ac-ink); }
.ac-cut__a { transform: translateX(-4px); }
.ac-cut__b { transform: translateX(4px); }
.ac-cut__thread { fill: none; stroke: var(--thread, #DD3858); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1 1; }
@media (prefers-reduced-motion: no-preference) {
  .ac-cut__a { animation: acPartA .8s var(--spring-k, ease) .3s both; }
  .ac-cut__b { animation: acPartB .8s var(--spring-k, ease) .3s both; }
  .ac-cut__thread { animation: acDraw .7s var(--ease-out, ease) .6s both; }
}
@keyframes acPartA { from { transform: none; } }
@keyframes acPartB { from { transform: none; } }

/* Evening: the pictures keep their own Indigo discs, lifted a little off the Night card */
:root[data-look="evening"] .ac-key__disc:not(.ac-weave__disc):not(.ac-cut__disc), :root[data-look="evening"] .ac-done__disc, :root[data-look="evening"] .ac-sent__back { fill: #222C6C; }
@media (prefers-color-scheme: dark) { :root[data-look="auto"] .ac-key__disc:not(.ac-weave__disc):not(.ac-cut__disc), :root[data-look="auto"] .ac-done__disc, :root[data-look="auto"] .ac-sent__back { fill: #222C6C; } }

/* ---------- the forgot-password sheet on the log-in page: the key becomes the envelope once the link is sent ---------- */
.door__fp .ac-sent { display: none; width: 150px; }
.door__fp:has([data-forgot-after]:not([hidden])) .door__key { display: none; }
.door__fp:has([data-forgot-after]:not([hidden])) .ac-sent { display: block; }

